Hacker News new | ask | show | jobs
by sph 3 days 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.
2 comments

The 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.
Taking the object as the last argument works just as well. Just needs to be consistent whichever way is chosen.