[Haskell-cafe] Memoization

Erik de Castro Lopo hc-erikd at mega-nerd.com
Sat May 26 23:24:48 EDT 2007


Stefan O'Rear wrote:

> 
> memofix :: ((a -> b) -> (a -> b)) -> a -> b
> memofix ff = let g = memoize (ff g) in g
> 
> fib = memofix $ \fib k -> case k of
>         0 -> 0
>         1 -> 1
>         n -> fib (n-1) + fib (n-2)

Stefan, these is something missing here. Where is memoize
defined?

Erik
-- 
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
I hack, therefore I am.


More information about the Haskell-Cafe mailing list