On this page:
define/  memoize
lambda/  memoize
case-lambda/  memoize
let/  memoize
memoize-procedure
call/  memoize
memoize
memo-table?
make-memo-table
clear-memo-table!
8.12

7.5 mischief/memoize: Memoized Functions🔗ℹ

 (require mischief/memoize) package: mischief

syntax

(define/memoize (name . kw-formals) body ...+)

syntax

(lambda/memoize kw-formals body ...+)

syntax

(case-lambda/memoize [formals body ...+] ...)

syntax

(let/memoize loop-id {[x e] ...} body ...+)

Variants of define (for functions), lambda, case-lambda, and (named) let that produce memoized functions.

procedure

(memoize-procedure proc)  procedure?

  proc : procedure?
Produces a memoized version of proc.

procedure

(call/memoize memo    
  proc    
  arg-or-keyword-arg ...)  any
  memo : memo-table?
  proc : procedure?
  arg-or-keyword-arg : any/c
If the sequence of positional and keyword arguments has an entry in memo, produces the stored result. Otherwise, passes the arguments to proc and records the result in memo before returning (or raising) it.

procedure

(memoize memo key ... #:compute proc)  any

  memo : memo-table?
  key : any/c
  proc : (-> any)
If the sequence of keys has an entry in memo, produces the stored result. Otherwise, calls proc and records the result in memo before returning (or raising) it.

procedure

(memo-table? x)  boolean?

  x : any/c
Recognizes memoization tables.

procedure

(make-memo-table)  memo-table?

Creates a fresh memoization table.

procedure

(clear-memo-table! memo)  void?

  memo : memo-table?
Erases the contents of memo.