Re:Microfeatures I'd like to see in more languages
by jbverschoor on Thursday January 05, 2023 @05:14PM
(#34267628)
I was under the impression that Elixir introduced this.
[ Parent
| on HN ]
Re:Microfeatures I'd like to see in more languages
by masklinn on Thursday January 05, 2023 @05:30PM
(#34267818)
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 "(&)".