Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Mutual-recursion/Erlang/mutual-recursion.erl
Normal file
13
Task/Mutual-recursion/Erlang/mutual-recursion.erl
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
-module(mutrec).
|
||||
-export([mutrec/0, f/1, m/1]).
|
||||
|
||||
f(0) -> 1;
|
||||
f(N) -> N - m(f(N-1)).
|
||||
|
||||
m(0) -> 0;
|
||||
m(N) -> N - f(m(N-1)).
|
||||
|
||||
mutrec() -> lists:map(fun(X) -> io:format("~w ", [f(X)]) end, lists:seq(0,19)),
|
||||
io:format("~n", []),
|
||||
lists:map(fun(X) -> io:format("~w ", [m(X)]) end, lists:seq(0,19)),
|
||||
io:format("~n", []).
|
||||
Loading…
Add table
Add a link
Reference in a new issue