[Haskell-cafe] Do I have this right? "Remembering" Memoization!
mwotton at gmail.com
Sun Sep 13 19:45:28 EDT 2009
On 14/09/2009, at 9:28 AM, Casey Hawthorne wrote:
> Do I have this right? "Remembering" Memoization!
> For some applications, a lot of state does not to be saved, since
> "initialization" functions can be called early, and these functions
> will "remember" - (memoize) their results when called again, because
> of lazy evaluation?
You don't get memoisation for free.
If you define a variable once in a where block, it's true that you'll
evaluate it at most once, but if you repeatedly call a function "foo"
that then calls "bar 12" each time, "bar 12" will be evaluated once
per "foo" call.
More information about the Haskell-Cafe