[Haskell-cafe] Memoization local to a function

=?windows-1250?Q?Du=9Aan_Kol=E1=F8?= kolar at fit.vutbr.cz
Thu Feb 26 13:16:12 EST 2009

Thanks for all the hints and code provided, nevertheless, it implied 
another questions:

1) Am I right that MemoCombinators can be hardly ever used with hugs? If 
not, which guidelines to be used for installation...
2) Is there any paper/tutorial/wiki that describes, which local 
definitions/expressions are "discarded"/"not shared" after/"to the next" 
computation, that means separated closure is built for them?


Henning Thielemann wrote:
> On Wed, 25 Feb 2009, Luke Palmer wrote:
>> On Wed, Feb 25, 2009 at 10:38 AM, Dusan Kolar <kolar at 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


  Dusan Kolar            tel: +420 54 114 1238
  UIFS FIT VUT Brno      fax: +420 54 114 1270
  Bozetechova 2       e-mail: kolar at fit.vutbr.cz
  Brno 612 66
  Czech Republic


More information about the Haskell-Cafe mailing list