"Arjan van IJzendoorn" <[EMAIL PROTECTED]> writes:

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

You need to call the memoised version in the recursive case.

> module Fib where
> 
> import Memo
> 
> slow 0 = 0
> slow 1 = 1
> slow n = slow (n-1) + slow (n-2)

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

> fast n = memo slow n

Regards,
    Malcolm
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to