ParamPipe - parameterized pipe in Elixir

I like it: elegant and concise solution to a common problem. It can coexist with regular pipes and the eye immediately catches when a special syntax is used. I believe (some way of doing) this will become standard in the future languages.

While some of the cases when you want to pipe to a non-first argument would benefit from changing the argument order (the standard-ness of data as first argument eases the cognitive load), there are some examples where you want this. E.g. GitHub - smpoulsen/focus: Lightweight Elixir lenses · GitHub (lenses) project recently introduced another set of function heads: Add function heads for view/set/over to allow pipeline-able versions · smpoulsen/focus@1da55c7 · GitHub - to combat just this. Notice how the author expresses his doubts about ambiguity of such approach. Making it easy to pipe to any argument (without using an ugly inline function) would generalize a solution to this problem.

1 Like