Skip to content

Instantly share code, notes, and snippets.

marcincembrzynski

Block or report user

Report or block marcincembrzynski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ex1.erl
-module(ex1).
-export([server/1,pal_check/1,pal_check_answer/1]).
server(Pid) ->
receive
{check, String} ->
io:format("got: " ++ String),
Pid ! { result, pal_check_answer(String)},
server(Pid);
View f3.erl
-module(f3).
-export([double/1,evens/1,sort/1,minimum/1,median/1,elem/2,elem/3,modesElem/2,modesElem/3,maxT/1,maxT2/2,modes/1,fst/1,occur/1]).
double([X]) -> [X * 2];
double([X|XS]) -> [(X * 2) | double(XS)].
evens([X]) -> [X];
evens([X|XS]) -> case (X rem 2 == 0) of
true -> [X | evens(XS)];
false -> evens(XS)
View f2.erl
-module(f2).
-export([product/1,maximum/1,productTail/1,productTail/2,maximumTail/1,maximumTail/2]).
product([X]) -> X;
product([X|XS]) -> X * product(XS).
productTail(L) -> productTail(L,1).
productTail([],P) -> P;
View rec.erl
-module(rec).
-export([fib2/1,fib2Acc/3,perfectAcc/3,perfect/1]).
fib2(0) -> 0;
fib2(N) -> fib2Acc(0,1,N - 1).
fib2Acc(_,B,0) -> B;
fib2Acc(A,B,N) -> fib2Acc(B, A+B , N - 1).
You can’t perform that action at this time.