3 ms·
Agreed. Some functional languages (like F#) have a pipelining operator |> that gives the same syntactic impression: list |> map (1+) |> filter odd |> sum
by Twisol 7y ago
Agreed. Some functional languages (like F#) have a pipelining operator |> that gives the same syntactic impression:
list |> map (1+) |> filter odd |> sum
- codr7 7y agoAnd other languages, such as Forth; don't need one. list map filter odd sum
- Twisol 7y agoHuh. I would've expected it to be `odd filter`, not `filter odd`.
- the_gipsy 7y agoI have found myself using pipes many times in Elm, because they make the code so much more readable. Now I understand why! I haven't seen an autocomplete that works on pipes. But with a good type system, it is technically possible to list all compatible functions that take "noun" as first parameter. Sometimes you supply partially applied functions (also with pipes in noun->verb order) and that's not so easy to match: noun |> verb1 |> (otherNoun >> verb2) |> etc But perhaps even functions that take "noun" as nth parameter could be suggested.
- zwaps 7y agoInterestingly enough, the now standard data manipulation package in R, dplyr, uses pipelines.
- karmakaze 7y agoGood to learn me some F#, looks like Elixir.