Skip to content

Instantly share code, notes, and snippets.

View tambow44's full-sized avatar

Thomas tambow44

View GitHub Profile
@tambow44
tambow44 / fourth.erl
Created May 13, 2020 06:12
2nd week of Erlang on FutureLearn (2.3)
-module fourth.
-export[fac/1,fib/1,pieces/1].
fac(0) ->
1;
fac(N) when (N > 0) ->
fac(N - 1) * N
.
fib(0) ->
-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 03:43
Functional Programming in Erlang, FutureLearn - 1.9 "My first Erlang program"
-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) ->