RFC: Extending Pipe

Yes.

In general, one of my main gripes about Elixir syntax is that anonymous functions are second-class citizens. Basically this:

> a_fun = fn x -> List.flatten x end
#Function<6.54118792/1 in :erl_eval.expr/5>
> a_fun([1, [2], 3])
** (CompileError) iex:17: undefined function a_fun/1
> a_fun [1, [2], 3]
** (CompileError) iex:17: undefined function a_fun/1
iex(17)> [1, [2], 3] |> a_fun
** (CompileError) iex:17: undefined function a_fun/1
 (elixir) expanding macro: Kernel.|>/2
 iex:17: (file)

This is especially evident in pipes where you have to do all kinds of weird contortions to make a call work. As shown in the post:

1 |> (&Enum.at([1, 2, 3], &1)).()

It may be too late to change though. Because if Elixir introduces the “proper”, less verbose syntax, it will need to support both the old and the new syntax for god only knows how long.