Hacker News new | ask | show | jobs
by the_duke 1737 days ago
Chained function calls only work if the types in question have immutable functions that support chaining. This is the case for arrays with `map`, `filter` and for promises with then/catch.

But it's not the case for the majority of libraries, including many of the builtin types.

A pipeline operator is generic and can be used everywhere, without requiring the API to be built around chaining. This can often lead to much nicer, more readable code.

I think this is something you only start to really appreciate once you've used it a bit, like in Elixir or F#.

Obviously this is much more natural in a functional language, where everything is immutable anyway.