|
|
|
|
|
by gotchange
3825 days ago
|
|
$ (1..10) |> Enum.map(&(&1**&1)) |> Enum.filter(&(&1 < 40))
This is the equivalent of this piping op done in terse style JS: [for (i of Array(10).keys()) ++i].map(e=> e*e ).filter(e=> e<40 )
This is not as concise as the example you provided but it's still very neat and powerful. |
|
The Elixir pipe syntax is reminiscent of Clojure's ->/->>:
It's nice that in languages like Haskell or ML this is trivial: You could modify this to let NONE fall through, etc.