Funs names in Erlang 17

后端 未结 3 1375
广开言路
广开言路 2021-01-13 00:32

Erlang 17 was released. And according to Erlang OTP 17.0 has been released:

Funs can now be given names

No examples are given.

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-13 00:58

    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.

提交回复
热议问题