|
|
|
|
|
by nextaccountic
1853 days ago
|
|
This x |> h |> g |> f syntax is Elixir (and F# perhaps? and surely other langs). In Haskell this is written x & h & g & f
And in shell script, this is written echo x | h | g | f
This operator is sometimes called the pipeline operatorAnyway, here is some ghci session exemplifying the usage of the & operator $ ghci
λ import Data.Function((&))
λ a f g h x = x & h & g & f
λ b f g h x = (f . g . h) x
λ c = f g h x = f (g (h x))
λ a (+ 1) (* 2) (+ 3) 1
9
λ b (+ 1) (* 2) (+ 3) 1
9
λ c (+ 1) (* 2) (+ 3) 1
9
It's unfortunate that this is named & in Haskell and not |>. And what's worse, it's not in the prelude. |
|