Hacker News new | ask | show | jobs
by nurettin 299 days ago
Ruby has a unified interface for select/map/reduce over all containers. They do lazy calculations if specified. You can chain expressions simply by appending them at the end without scrolling to the back of the expression. That is objectively better than lisp and python.

Sure, you can always rewrite to match that style with macros in lisp and generators in python, but they weren't meant to be used that way.

Sad thing about ruby is how they failed to do typing. I love python's typing module. I think it is the single best thing about python and I wouldn't touch python with a pole if it didn't have that module.

1 comments

Lisp was absolutely meant to be used that way.
What I meant was how (op modifier *params) "homomorphism" is praised by literally everyone and their dog and it is simply worse than params.op1(modifier).op2(modifier)
What GP (probably) meant is that in Lisp you're supposed to write macros, and when you do, this "is simply not worse" than the dotted message sends:

    (-> params (op1 mod2) (op2 mod2))
        params .op1(mod2) .op2(mod2)
There's a reason why just about every Lisp currently in use[1] has `->`/`->>`[2] macros: they're just so easy to write that not having them would be strange. Same with |> in OCaml - with currying, it's literally just `let (|>) x f = f x;;`. So, while it's true that Lisp (or OCaml) base language doesn't have the particular convenience, it's also true that in Lisp (and, in this case, in OCaml) you are meant to extend the language to allow such conveniences.

[1] With a glorious exception of PicoLisp, because quote is all you'll ever need.

[2] And more! With `doto` you have Smalltalk/Dart cascades, with `nest` (https://github.com/ruricolist/serapeum/blob/master/REFERENCE...) you have decorators, etc.

OCaml does have the |> operator