Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas tambow44

View GitHub Profile
@tambow44
tambow44 / fourth.erl
Created May 13, 2020
2nd week of Erlang on FutureLearn (2.3)
View fourth.erl
-module fourth.
-export[fac/1,fib/1,pieces/1].
fac(0) ->
1;
fac(N) when (N > 0) ->
fac(N - 1) * N
.
fib(0) ->
View third.erl
-module(third).
-export([xor_1/2,xor_2/2,xor_3/2,max_three/3,how_many_equal/3]).
% '=/=' and '==' are the operations for inequality and equality in Erlang
xor_1(X,Y) ->
(X =/= Y)
.
% 'not' is the Erlang negation function
xor_2(X,Y) ->
@tambow44
tambow44 / first.erl
Created May 5, 2020
Functional Programming in Erlang, FutureLearn - 1.9 "My first Erlang program"
View first.erl
-module(first).
-export([multiply/2,square/1,double/1,treble/1,area/3]).
multiply(X,Y) ->
X*Y.
square(X) ->
multiply(X,X).
double(X) ->