The “referential transparency” of applicative language expressions demands that all occurrences of an expression in a given context yield the same value. In principle, that value therefore needs to be computed only once. However, in recursive programming, a context usually unfolds dynamically, precluding textual recognition of multiple occurrences, so that such occurrences are recomputed. To remedy the lack, in applicative languages, of an ability to store and retrieve a computed value under programmer control, “caching functionals” are proposed which allow the programmer to selectively avoid recomputation without overt use of assignment. The uses and implementation of such mechanisms are discussed, including reasons and techniques for purging the underlying cache. Our approach is an extension of the early notion of “memo function”, enabling improved space utilization and a “building-block” approach.
|Number of pages
|ACM Transactions on Programming Languages and Systems
|Published - 1986