Mon Nov 26 09:18:09 CET 2012
Here are two reasons to use anonymous functions.
1) You do not want to create a real function.
2) You want to capture some variables into a function. Erlang shell ex:
Variable = 42.
Add_variable = fun (N) -> N + Variable end.
Add_variable( 2 ).
On Mon, 2012-11-26 at 10:09 +0200, Lucky Khoza wrote:
> Morning Erlang Developers,
> I would like to ask about: when do we use funs or anonymous functions
> in Erlang?, I know what it is, but I can't really figure out when to
> use it and I saw an example of it being used with Mnesia
> May someone help in this regard please.
> Kindest Regards
> Lucky Khoza
> erlang-questions mailing list
More information about the erlang-questions