7 ms·
Not quite sure what you mean. But how do you chain multiple functions?
by yanis_t 8y ago
Not quite sure what you mean. But how do you chain multiple functions?
- bunderbunder 8y agoWith the way syntax for function calls works, the innermost thing is executed first, and you end up reading stuff from right to left: third(z, second(y, first(x))) With the pipeline operator (and assuming a language that allows partial application), the order in which things execute matches the order in which you read it: first x |> second y |> third z The benefits start getting more noticeable when you're talking about stuff like manipulating sets of data. For example: myList |> filter (x -> x.color == 'red') |> sortBy (x -> x.count) |> first compared to these sorts of pyramids of doom: first( sortBy( x -> x.count, filter( x -> x.color == 'red', myList ) ) )