The memoize Reference Manual

This is the memoize Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 07:02:01 2024 GMT+0.

Table of Contents


1 Systems

The main system appears first, followed by any subsystem dependency.


1.1 memoize

Source

memoize.asd.

Child Component

memoize.lisp (file).


2 Files

Files are sorted by type and then listed depth-first from the systems components trees.


2.1 Lisp


2.1.1 memoize/memoize.asd

Source

memoize.asd.

Parent Component

memoize (system).

ASDF Systems

memoize.


2.1.2 memoize/memoize.lisp

Source

memoize.asd.

Parent Component

memoize (system).

Packages

org.tfeb.hax.memoize.

Public Interface
Internals

3 Packages

Packages are listed by definition order.


3.1 org.tfeb.hax.memoize

Source

memoize.lisp.

Use List

common-lisp.

Public Interface
Internals

4 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


4.1 Public Interface


4.1.1 Macros

Macro: def-memoized-function (fnspec args &body bod)

Define a memoized function.
FNSPEC is either the name of the function, or a list suitable as an arglist for MEMOIZE-FUNCTION. ARGS & BOD are passed off to DEFUN.

This will declare FNSPEC NOTINLINE, which may be necessary to prevent good compilers optimizing away self calls & stuff like that.

Package

org.tfeb.hax.memoize.

Source

memoize.lisp.

Macro: memoized-labels ((&rest labdefs) &body bod)

A version of LABELS that memoizes the local functions. See MEMOIZE-FUNCTION and DEF-MEMOIZED-FUNCTION. If code that uses this is compiled (either by COMPILE or COMPILE-FILE, then the table of memoized results will be unique, if interpreted then a new table may be generated for each use. The function ‘names’ are generalised in the same way as for DEF-MEMOIZED-FUNCTION.

Package

org.tfeb.hax.memoize.

Source

memoize.lisp.


4.1.2 Ordinary functions

Function: clear-memoized-function (fn-name)

Clear memoized results for FN-NAME

Package

org.tfeb.hax.memoize.

Source

memoize.lisp.

Function: clear-memoized-functions ()

Clear memoized results for all functions

Package

org.tfeb.hax.memoize.

Source

memoize.lisp.

Function: function-memoized-p (fn-name)

Is FN-NAME memoized?

Package

org.tfeb.hax.memoize.

Source

memoize.lisp.

Function: memoize-function (fn-name &key key test)

Memoize FN-NAME, a symbol, causing its results to be stashed.
KEY is a function which is given the arglist of FN-NAME, and should return a key to hash on for memoizing. TEST is a function which the test for the ashtable.
See Norvig P269-275.

Note this function may not work on self-recursive functions because the compiler can optimize away self-calls in various ways. DEF-MEMOIZED-FUNCTION should work for those cases as it is careful to ensure the function can not be inlined like this.

Package

org.tfeb.hax.memoize.

Source

memoize.lisp.

Function: unmemoize-function (fn-name)

Remove memoization for FN-NAME

Package

org.tfeb.hax.memoize.

Source

memoize.lisp.

Function: unmemoize-functions ()

Unmemoize all functions

Package

org.tfeb.hax.memoize.

Source

memoize.lisp.


4.2 Internals


4.2.1 Special variables

Special Variable: *memoized-functions*
Package

org.tfeb.hax.memoize.

Source

memoize.lisp.


4.2.2 Ordinary functions

Function: make-memo (fn key test)
Package

org.tfeb.hax.memoize.

Source

memoize.lisp.


Appendix A Indexes


A.1 Concepts


A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*memoized-functions*: Private special variables

S
Special Variable, *memoized-functions*: Private special variables