This file contains hidden or 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(lists_module). | |
-export([product/1, maximum/1, product_t/1, maximum_t/1]). | |
% direct | |
product([]) -> | |
1; | |
product([H|T]) -> | |
H*product(T). |
This file contains hidden or 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
% Functional programming Erlang 1 - Assignment | |
% | |
% Author: Rowinson G. | |
% For testing use this gist: https://gist.github.com/rwngallego/1a516188a3542dd5ec46c855c89ef0e5 | |
-module(all_together). | |
-export([perimeter/1, area/1, enclose/1, bits/1, bits_tail/1]). | |
%%%%%% Shapes %%%%%%% |
This file contains hidden or 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
%%%%%% Testing %%%%%% | |
% Copy and paste the following content into the erl console | |
Circle = {circle, 45}. | |
Rectangle = {rectangle, 5, 7}. | |
RightTriangle = {right_triangle, 3, 4, 5}. | |
all_together:perimeter(Circle). | |
all_together:perimeter(Rectangle). | |
all_together:perimeter(RightTriangle). | |
all_together:area(Circle). |