Kernel.SpecialForms.fn

You're seeing just the macro fn, go back to Kernel.SpecialForms module for more information.

Defines an anonymous function.

See Function for more information.

Examples

iex> add = fn a, b -> a + b end
iex> add.(1, 2)
3

Anonymous functions can also have multiple clauses. All clauses should expect the same number of arguments:

iex> negate = fn
...>   true -> false
...>   false -> true
...> end
iex> negate.(false)
true