View first.erl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-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) -> |
View third.erl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-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) -> |
View fourth.erl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module fourth. | |
-export[fac/1,fib/1,pieces/1]. | |
fac(0) -> | |
1; | |
fac(N) when (N > 0) -> | |
fac(N - 1) * N | |
. | |
fib(0) -> |