Chinaunix
标题:
怎么写在函数内的匿名函数
[打印本页]
作者:
patagonia2
时间:
2016-04-14 16:11
标题:
怎么写在函数内的匿名函数
f2(N) when N < 2 -> N;
f2(N) -> f2(N - 1) + f2(N - 2).
复制代码
怎么写在函数内的匿名函数 (f3 == f2)
f3(N) -> fun ...
复制代码
作者:
shijiang1130
时间:
2016-04-14 16:27
(fun(X) when X =:= "Chinaunix" -> io_lib:format("~p",[allow]); (_) -> "DENY" end)("Chinaunix").
复制代码
作者:
shijiang1130
时间:
2016-04-14 16:28
46> (fun () when Age > 42 -> io:format("You are old~n"); () -> io:format("You are young~n") end)().
You are old
ok
47> Age.
99
48>
复制代码
作者:
patagonia2
时间:
2016-04-14 16:40
回复
3#
shijiang1130
图哥?你有一个明确的例子?
f2(40) ==> 102334155
f3(40) ==> 102334155
作者:
patagonia2
时间:
2016-05-25 11:44
图哥++
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2