On Wed, 25 Feb 2009, Luke Palmer wrote:

On Wed, Feb 25, 2009 at 10:38 AM, Dusan Kolar <ko...@fit.vutbr.cz> wrote:
       I have a function a computation of which is quite expensive, it is 
recursively
      dependent on itself with respect to some other function values - we can 
roughly
      model its behaviour with fib function (returns n-th number of Fibonacci's
      sequence). Unfortunately, it is not fib, it is far more complicated.
      Nevertheless, for demonstration of my question/problem I will use fib, 
it's quite
      good.


I suggest using data-memocombinators for this rather than rolling your own.  It 
accomplishes
the same thing, but makes the choice of memo structure independent of the code 
that uses it
(and Memo.integral has asymptotically better performance than a list).

Nice to know that there is a package for this purpose. See also
  http://haskell.org/haskellwiki/Memoization
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to