Simpler Fibonacci function
Tue, 05 Feb 2002 14:08:05 -0500
> 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:
> This is perhaps unfortunate since fib is a kind of "hello world" for
> Haskell and other FP languages.
Well, I cannot speak for the other references, since I did not write
them :-). On the other hand, stream processing *is* a stylistic way to
write certain kinds of functional programs, with the idea of replacing
an iteration with a stream. But I agree that this particular example
should not be the equivalent of "hello world". (Of course, for that,
one would just write:
print "hello world"