fork download
  1. -module(prog).
  2. -export([main/0]).
  3.  
  4. main() ->
  5. F = fun(_, 0) -> 1;
  6. (Fun, N) -> N * Fun(Fun, N-1) end,
  7. Fact5 = F(F, 5),
  8. io:format("5! = ~p~n", [Fact5]).
Success #stdin #stdout 0.18s 8448KB
stdin
undefined
stdout
5! = 120