I am new to functional programming and teaching myself Haskell.  The
canonical Haskell "fib" function (e.g. as presented in the "Gentle"
tutorial) is:

   fib = 1 : 1 : [ a+b | (a,b) <- zip fib (tail fib) ]

This seems, to be polite, a bit overly complex.  By comparison, here
is a simpler version:

   fib x y = x : fib y (x+y)

For example, fib 1 1 => [1,1,2,3,5,8,13,21,...].

Is there a reason why the canonical fib function is so complex?  If
not, would it be possible to use a simpler version in the tutorial? 
Thanks.

-- Brian
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to