Haskell does not maintain a cache mapping function calls to their values, so if you have some function f and call it with, say, the argument 7 in two different places in your code, then it will re-evaluate the function at each point.  The only time it will not do this is when it can see explicitly that the value will be shared, i.e. situations like "g (f 7) (f 7)" should only result in one evaluation of f 7 in simple cases, presuming the compiler is sufficiently smart.

Cheers,
Greg


On Dec 15, 2009, at 7:32 PM, 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


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe