Hacker News new | ask | show | jobs
by zosima 4837 days ago
Yes, many languages support something eqivalent. Classically object oriented languages not the least:

a.h().g().f()

I feel that prefix notation is one of the greatest impediment to the uptake of Lisps. And I think it's important to underscore that you can (idiomatically) choose prefix, postfix or infix depending on the character of your problem.

If the code is (unnecessarily) hard to read, then express it differently. The language encourages it.

1 comments

Actually the equivalent of the above Perl 6 code would be:

    f(g(h(a)))
It can get kind of gnarly when any of the values are non-trivial.
Translated directly, yes.

But when you have objects and no piping operator, library designers will often choose to implement pipe flow as method chaining. See e.g. jQuery, Scala's collections or many ORMs, like SQLAlchemy.