Simpler Fibonacci function

Brian Berns Berns@rdacorp.com
Tue, 5 Feb 2002 13:57:32 -0500


> The only reason the first version of fib was used in the Gentle Intro was
to
> demonstrate recursive stream processing...

Thank you for the explanation.

For reference, the fib example occurs in a section (3.4) titled "'Infinite'
Data Structures", of which I believe the simpler function is also an
example.  There is no reference in this section to recursive stream
processing (this occurs in section 4.4).

In any case, as a newbie, I can tell you that I found the fib function
puzzling as stated.

> ...and not to show a "canonical" version of Fibonacci

Nonetheless, it seems to have become the canonical version.  For example,
see the list of references to this version on Google:
http://www.google.com/search?q=%22zip+fib+%28tail+fib%22.

This is perhaps unfortunate since fib is a kind of "hello world" for Haskell
and other FP languages.

-- Brian