On 1/12/08, Henning Thielemann <[EMAIL PROTECTED]> 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 In Python, it's pretty easy to memoize this. How can I do it in Haskell? I suspect the only way would involve changing the function signature to use IO or ST. It would be nice if I could just tell the compiler "I command you to memoize this function", and have it produce the required code automatically. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe