Skip to content

Instantly share code, notes, and snippets.

@yrashk
Created January 28, 2012 04:26
Show Gist options
  • Save yrashk/aafded15a61bc081fcd1 to your computer and use it in GitHub Desktop.
Save yrashk/aafded15a61bc081fcd1 to your computer and use it in GitHub Desktop.
fib_list(0) -> 0;
fib_list(1) -> 1;
fib_list(N) ->
fib_list(N + 1, [1,0]).
fib_list(End, [H|_]=L) when length(L) == End -> H;
fib_list(End, [A,B|_]=L) ->
fib_list(End, [A+B|L]).
@richcarl
Copy link

Right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment