[Haskell-cafe] Fibbonachi numbers algorithm work TOO slow.

ajb at spamcop.net ajb at spamcop.net
Mon Nov 5 19:08:35 EST 2007


G'day all.

Quoting Dan Weston <westondan at imageworks.com>:

> In any case, to answer your question more specifically, the memoization
> of *constants*

I think you meant "CAFs".

> You can just unroll the loop
> yourself to see. The following runs as fast as you'd expect:
>
> fib00 = 0
> fib01 = 1
> fib02 = fib00 + fib01
[deletia]
> fib30 = fib28 + fib29

This is why we don't pay programmers by LOC.

> For a parametrized function fib n, no mere syntactic transformation can
> be so made.

That's right, but you can do it by hand.

Incidentally, we've been here before.  Check out this thread:

     http://comments.gmane.org/gmane.comp.lang.haskell.cafe/19623

Cheers,
Andrew Bromage


More information about the Haskell-Cafe mailing list