doc.txt

Memoize

_Memoize_
_memoize_

This collection provides one file:

 _memoize.ss_: macros for defining memoized procedures

This library provides a syntax for defining memoized procedures.

======================================================================

> (memo-lambda (args ...) body0 body1 ...)

A syntax for defining memoized anonymous procedures. Arguments are mapped to
their results by storing them in a local hash-table (using eq? to compare
arguments for equality).

Simpler cases are optimized: the zero-argument variant simply saves its result
in a local variable, and the one-argument variant maps its argument to its
result in a local hash table. The multiple-argument variant maps its entire list
of arguments to its result in a local hash table, attempting to reduce search
time by hashing on the bitwise-xor of the hashcodes of its arguments.

> (define/memo (args ...) body0 body1 ...)

A syntax corresponding to the standard Scheme procedure definition
shorthand. This macro expands to a (define (args ...) etc.) form, so it can be
used in any context that accepts such procedure definitions. In particular, this
means it can be used to define memoized methods with the mzscheme class library.