3 ms·
Elixir has it. To make it worthwhile, the entire standard library has to be designed to have the ‘object’ of the function as first argument. [1,2,3] |> E
by sph 4mo ago
Elixir has it. To make it worthwhile, the entire standard library has to be designed to have the ‘object’ of the function as first argument.
[1,2,3]
|> Enum.map(&square/1)
|> Enum.filter(&odd?/1)
Using a threading operator where there is no such consistency is painful. This is why I dislike CL’s or Python’s map function, taking the list to operate on as second argument, instead of first. A threading operator wouldn’t be as effective there.
- shawn_w 4mo agoTaking the object as the last argument works just as well. Just needs to be consistent whichever way is chosen.
- Blikkentrekker 4mo agoThe issue is that these functions in Lisps are variadic and can accept more arguments than one. `map`, and `zipwidth` in lisps are actually the same function.