Erlang 17 was released. And according to Erlang OTP 17.0 has been released:
Funs can now be given names
No examples are given.
Named funs are a implementation of EEP37 see the link for a detailed description and rationale.
Joe Armstrong explains it in his blog post with an example.
1> F = fun F(0) -> 1;
F(N) -> N * F(N - 1)
end.
#Fun
Previously you have to pass in the function as one of the args for anonymous recursive calls. (Think of y-combinator).
1> F = fun(F, 0) -> 1;
(F, N) -> N*F(F, N-1)
end.
#Fun
This version doesn't need to pass in the function as one of the args:
1> Fac = fun(Num) ->
Foo = fun(F, 0) -> 1;
(F, N) when N > 0, is_integer(N) -> N * F(F, N -1) end,
Foo(Foo, Num) end.