[Haskell-cafe] Re: speeding up fibonacci with memoizing

Henning Thielemann lemming at henning-thielemann.de
Tue Nov 6 08:56:23 EST 2007


On Tue, 6 Nov 2007, marnes wrote:

>
>   fib :: Integer -> Integer
>   fib n = fibaux n 0 1 1
>    where
>     fibaux :: Integer -> Integer -> Integer -> Integer -> Integer
>     fibaux i a b c | i==0 = a
>                    | i/=0 = fibaux (i-1) b c (b+c)

http://www.haskell.org/haskellwiki/Memoization


More information about the Haskell-Cafe mailing list