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([double/1,mult/2,area/3,square/1,treble/1]). | |
mult(X,Y) -> | |
X*Y. | |
square(X) -> | |
mult(X,X). | |
double(X) -> |
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(variables_patterns). | |
-export([xORone/2,xORtwo/2,xORthree/2,maxThree/3,howManyEqual/3,testall/0]). | |
% @doc xORone performs an Exclusive OR using the inequality operator '=/=' | |
xORone(X,Y) -> | |
X =/= Y. | |
% @doc xORtwo performs an Exclusive OR using a negated equality operator | |
xORtwo(X,Y) -> | |
not (X == Y). |
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 fibonacci_pieces. | |
-export [test/0]. | |
-export [fib/1]. | |
-export [pieces/1]. | |
test() -> | |
0 = fibonacci_pieces:fib(1), | |
5 = fibonacci_pieces:fib(6), | |
1 = fibonacci_pieces:pieces(0), | |
2 = fibonacci_pieces:pieces(1), |
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 perfect. | |
-export [test/0]. | |
-export [is_perfect/1]. | |
test() -> | |
true = perfect:is_perfect(1), | |
false = perfect:is_perfect(2), | |
false = perfect:is_perfect(5), | |
true = perfect:is_perfect(6), | |
false = perfect:is_perfect(24), |