[Haskell-cafe] Memoisation

Tony Morris tmorris at tmorris.net
Sun Feb 25 16:54:56 EST 2007

I have a backtracking algorithm that I need to memoise with. Rather than
go into the intricacies of the algorithm, I figure (and hope) the
factorial function is trivial enough to point out my problem.

Simply, suppose I wish to calculate the factorial of 10, then "later"
the factorial of 5. I have already calculated the factorial of 5, but
now I must do it again. I have thought of various ways of preventing
this; perhaps passing an Array in a state monad. I'm wondering if there
is a general solution for this kind of problem.

Thanks for any tips.

Tony Morris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 191 bytes
Desc: OpenPGP digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070226/0bdc6798/signature.bin

More information about the Haskell-Cafe mailing list