~statianzo/sevenlangs

sevenlangs/erlang/fib.erl -rw-r--r-- 152 bytes
2fcd4511Jason Staten day one logic style 1 year, 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
-module(fib).
-export([fibr/1]).


fibr(N) -> fibloop(N, 1, 1).

fibloop(0, A, _) -> A;
fibloop(1, _, B) -> B;
fibloop(N, A, B) -> fibloop(N-1, B, A+B).