4 ms·
It's a problem with ML syntax, but one that can easily be overcome with parentheses. Sort of like how a circumspect C programmer uses parentheses in complex ma
by bunderbunder 13y ago
It's a problem with ML syntax, but one that can easily be overcome with parentheses. Sort of like how a circumspect C programmer uses parentheses in complex mathematical expressions rather than relying on everyone being able to correctly remember complex order of operation rules.
OTOH, pipeline operators make a good case for currying. There really is something nice about being able to write
sliceOfBread
|> smearWith peanut-butter
|> smearWith jelly
|> topWith sliceOfBread
|> cutInHalf
|> eat
instead of
eat(cutInHalf(topWith(sliceOfBread, smearWith(jelly, smearWith(peanut-butter, sliceOfBread)))))
- groovy2shoes 13y agoI just want to point out that the pipeline operator (or, more accurately, the forward application operator), is not provided by many ML implementations, but it's trivial to define it yourself. Here it is in Standard ML: infix |>; fun x |> f = f x; The definition is also similar in Haskell: x |> f = f x And in OCaml: let (|>) x f = f x;; F# and Elm provide this operator out of the box.