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",);(_) -> "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

图哥++ {:yxh57:}{:yxh57:}
页: [1]
查看完整版本: 怎么写在函数内的匿名函数