Beginner's question: Memo functions in Haskell

Arjan van IJzendoorn afie@cs.uu.nl
Wed, 5 Jun 2002 13:15:53 +0200


Oops, previous message left too soon

> However, the runtime performance is less pleasing as certain
> subexpressions are computed over and over again (profiling with ghc

There is a Memo module in Hugs, which I just used for fib. It doesn't seem
to speed it up, though:

--
module Fib where

import Memo

slow 0 = 0
slow 1 = 1
slow n = slow (n-1) + slow (n-2)

fast n = memo slow n
--

Maybe I'm doing something wrong.
If it would work, it might be useful for your function, too.

Arjan