Created
October 27, 2015 19:04
-
-
Save fmamud/8c032c06baebc87ab868 to your computer and use it in GitHub Desktop.
Erlang Bora module
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(bora). | |
-export([echo/1,fibonacci/1,mysum/1, reverse/1]). | |
echo(Any) -> Any. | |
fibonacci(0) -> 1; | |
fibonacci(1) -> 1; | |
fibonacci(N) -> fibonacci(N-1) + fibonacci(N-2). | |
mysum([]) -> 0; | |
mysum([H|T]) -> H + mysum(T). | |
reverse(List) -> | |
reverse(List, []). | |
reverse([Head|Rest], Reversed_List) -> | |
reverse(Rest, [Head | Reversed_List]); | |
reverse([], Reversed_List) -> | |
Reversed_List. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment