3 ms·
Elixir has forward pipes, but didn't invent them. For instance Racket and Clojure have threading macros, which are more flexible as they're just macros (Clojur
by masklinn 4y ago
Elixir has forward pipes, but didn't invent them.
For instance Racket and Clojure have threading macros, which are more flexible as they're just macros (Clojure's `->` is equivalent to Elixir's pipe operator, but `->>` will fill in the last parameter rather than first, and `-->` lets you use a keyword to define where the parameter is inserted in each call).
Haskell let anyone who wants define their own pipe operator, historically you had to BYO, which wasn't exactly hard:
(|>) = flip ($)
or
x |> f = f x
would do (modulo fixity), but today it's provided by default as "(&)".