Tail recursion

Dale Harvey <>
Fri Dec 16 04:18:02 CET 2005


fib(A,B,C,_) when A == B -> C;
fib(A,B,C,D) -> fib1(A,B+1,C+D,C).

call it with

fib(X,1,1,0).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20051216/62d5fb9e/attachment.html>


More information about the erlang-questions mailing list