[gambit-list] memoization of delayed computations

Christian Jaeger chrjae at gmail.com
Wed May 5 02:00:20 EDT 2010


> Are the results of forced delayed computations memoized in Gambit?

Gambit follows R5RS. See the description of force at
http://people.csail.mit.edu/jaffer/r5rs_8.html#SEC64

> If so, is this a recommended method for memoization?

It is the recommended method to write code using call by need, no more, no less.

Call by need means, the evaluation of an expression from a particular
runtime context is only being done if the result of the expression is
needed, and thanks to the implicit memoization, it is only being done
once even if the result (of that same expression from the same
context) is needed several times.

It does not however mean that the same promise (and hence memoized
result) will be reused if you happen to want the result of the same
expression but in a new runtime context, even if the context consists
of the same values as earlier.

Ch.



More information about the Gambit-list mailing list