by rlander · 5y ago · 0 comments
The Elixir implementation inverts the classical order of piping last in functional languages to the detriment of it. IMO a language should either support pipe last AND currying by default or supply a multitude of thread operators like Clojure does (->, ->>, as->, etc). Elixir's is just middle-of-the-road-weird.
Clojure is way more consistent in this regard:
- thread first (->) when operating on maps.
- thread last (->>) when operating on sequences.
- as-> "choose your own adventure".The only place where pipe order bristles is Enum.reduce, but I'd bet if I counted I'd have wanted it the normal way more often than the backwards way.
Clojure also doesn’t have auto currrying, but makes up for it by giving you 6 variants and creating a consistent default library for sequences and associative structures.
So, the pipe first operator is just a dirty hack.