Next: Conventional Calling, Up: Higher Ordered Fun
To make use of the memoization facilities, evaluate the form:
(use-modules (ice-9 poe))
This provides two “purity of essence” [insert actual Vonnegut allusion here, someday, or not] procedures for memoizing pure functions.
A pure function (of some sort) is characterized by two equality relations: one on argument lists and one on return values. A pure function is one that when applied to equal arguments lists yields equal results.
If the equality relationship on return values can be eq?, it may
make sense to cache values returned by the function. Choosing the right
equality relation on arguments is tricky.
The simplest case of pure functions are those in which results
are only certainly eq? if all of the arguments are.