Anonymous functions, usually called lambdas, are created with the fn keyword, as we can see in the following example:
iex> plus_one = fn (x) -> x + 1 end#Function<6.99386804/1 in :erl_eval.expr/5>iex> plus_one.(10)11
Here, we are defining a function that takes one argument, which we've named x, and simply adds one to the provided argument. We then bind this anonymous function to a variable named plus_one, and execute it with 10 as the argument, using the syntax we can see in the preceding snippet. As expected, we get 11 back.
An anonymous function can also have multiple implementations, depending on the value ...