[Haskell-cafe] Re: Haskell and "memoization"

Maciej Piechotka uzytkownik2 at gmail.com
Wed Dec 16 02:14:40 EST 2009


On Tue, 2009-12-15 at 19:32 -0800, michael rice wrote:
> I'm looking here at the Fibonacci stuff:
> 
> http://www.haskell.org/haskellwiki/Memoization
> 
> Since (I've read) Haskell never computes the value
> of a function more than once, I don't understand the
> need for memoization.
> 
> Enlighten me.
> 
> Michael
> 
> 

Sorry I'm asking - is there any reason why fib memorization goes beyond:

fib' = 1 : 1 : zipWith (+) fib' (tail fib')
fib n = fib' !! n

Regards





More information about the Haskell-Cafe mailing list