Skip to content
Snippets Groups Projects
Commit 3763afc7 authored by Sergio Pérez's avatar Sergio Pérez
Browse files

Example folder added

parent ab7bbc53
No related branches found
No related tags found
No related merge requests found
-module(bench14).
-export([main/2]).
main(X,Y) ->
Z = case X of
terminate -> "the end";
{A,B} -> {[A + B,B - A],3};
{3,C} -> g(C);
_ -> {20 * 3,8}
end,
T = 2,
V = f(T) + h(2) + h(3),
W = g([X,Y,{X,Y}]),
Tuple = {Z,W,V},
Tuple.
g(X) ->
[_,_,{R,S}] = X,
case R of
[1,3] -> 21;
[A,B] -> (A * B) / 9;
T -> T;
_ -> f(4)
end.
f(7) ->
L = 2 + 9,
F = L * 3,
F + L;
f(4) -> 9;
f(2) -> 7;
f(X) -> X.
h(X) ->
case X of
2 -> j({2,4});
3 -> k([4,8]);
1 -> l(107)
end.
j(A) ->
{X,_} = A,
X.
k(B) ->
[H|T] = B,
H.
l(C) -> C - 1.
\ No newline at end of file
-module(example).
-export([main/0]).
main() ->
{Sum,Prod} = sum_prod(10,10,0,0),
io:format("~p",[Sum]),
io:format("~p",[Prod]).
sum_prod(N,0,S,P) -> {S,P};
sum_prod(N,L,S,P) ->
S1 = S + 1,
P1 = P + N,
sum_prod(N,L-1,S1,P1).
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment