本文介绍了Erlang的乐趣名称17的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Erlang 17被释放。根据:

没有给出例子。



任何想法如何为Erlang 17中的乐趣分配名称?

解决方案

Joe Armstrong解释在他的中以示例为例。

  1> F = fun F(0)→> 1; 
F(N) - > N * F(N-1)
结束。
#Fun

以前,你必须将函数作为匿名参数之一传递递归调用(想想y-combinator)。

  1> F = fun(F,0)→> 1; 
(F,N) - > N * F(F,N-1)
结束。
#Fun


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

No examples are given.

Any ideas how to assign names to funs in Erlang 17?

解决方案

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

这篇关于Erlang的乐趣名称17的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 17:31