Elixir Function Capture
&
is the capture operator in Elixir.
&Module.function/arity
is shorthand for creating an anonymous function.
- Capture means
&
can turn a function into an anonymous functions which can be passed as arguments to other function or be bound to a variable.
So we can do things like this
The capture operator can also be used to create anonymous functions, for example:
is the same with: