[Haskell-cafe] Re: [newbie question] Memoization automatic in Haskell?

Stephane Bortzmeyer bortzmeyer at nic.fr
Mon Jan 14 08:38:22 EST 2008

On Sun, Jan 13, 2008 at 12:25:53AM +0100,
 Henning Thielemann <lemming at henning-thielemann.de> wrote 
 a message of 28 lines which said:

> Caching is not the default, but you can easily code this by
> yourself: Define an array and initialize it with all function
> values. Because of lazy evaluation the function values are computed
> only when they are requested and then they persist in the array.

It works only if the argument of the function is an integer or an
enumerated type. If the argument is a string and you do not know the
string values in advance, you cannot use the array.

More information about the Haskell-Cafe mailing list