Created
February 7, 2012 01:32
-
-
Save sowawa/1756467 to your computer and use it in GitHub Desktop.
Erlang prcatice with rackhub.
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
This is erlang practice. |
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(fib). | |
-export([fib/1]). | |
fib(0) -> 1; | |
fib(1) -> 1; | |
fib(N) when N > 0 -> fibo(N-1) + fibo(N-2) . | |
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
#!/usr/bin/env escript | |
main(_) -> io:format("~p~n",[fib:fib(8)]). | |
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
#!/usr/bin/env escript | |
main(_) -> io:format("Hello world~n"). | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment