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

Henning Thielemann lemming at henning-thielemann.de
Sat Jan 12 18:56:57 EST 2008


On Sat, 12 Jan 2008, David Benbennick wrote:

> On 1/12/08, Henning Thielemann <lemming at henning-thielemann.de> wrote:
> >  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.
>
> But how can I implement memoization for a more complicated function?
> For example, perhaps I want to memoize
>
> f :: String -> Int -> Double -> String -> Bool

There was a long thread about a sophisticated technique called "blue
prints", which allows you to use binary search trees as memoizing
structure.
 http://www.haskell.org/pipermail/haskell-cafe/2006-September/018204.html


More information about the Haskell-Cafe mailing list