Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the defmemo Reference Manual, version 1.5, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 04:25:37 2022 GMT+0.
Next: Systems, Previous: The defmemo Reference Manual, Up: The defmemo Reference Manual [Contents][Index]
Defmemo is a generic defun form, performing memoization over calls
to such defined function. It supports arbitrary lambda lists and
multiple return values. (optimize speed)-friendly, otherwise it might
have been implemented as in Peter Norvig's PAIP. Preserves arguments
and documentation. Memoizing hash table is stored under property
:memo
of defmemo'ed function.
Three functions are exported: defmemo
(like defun), get-memo
and clear-memo
(defmemo'ed symbol). Clear-memo is not needed on
implementations supporting weak hash tables (via trivial-garbage).
(defmemo fib (n)
(if (<= n 1)
1
(+ (fib (- n 1))
(fib (- n 2)))))
(fib 100)
; => 573147844013817084101
(get-memo 'fib)
; => #<hash-table :TEST equal :COUNT 101 :WEAKNESS :key>
(hash-table-count (clear-memo 'fib))
; => 0
Next: Files, Previous: Introduction, Up: The defmemo Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
Memoizing defun
Orivej Desh <orivej@gmx.fr>
Unlicense <http://unlicense.org/UNLICENSE>
1.5
Next: Packages, Previous: Systems, Up: The defmemo Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: defmemo/package.lisp, Previous: Lisp, Up: Lisp [Contents][Index]
defmemo (system).
Next: defmemo/defmemo.lisp, Previous: defmemo/defmemo.asd, Up: Lisp [Contents][Index]
defmemo (system).
Previous: defmemo/package.lisp, Up: Lisp [Contents][Index]
package.lisp (file).
defmemo (system).
flat-arglist (function).
Next: Definitions, Previous: Files, Up: The defmemo Reference Manual [Contents][Index]
Packages are listed by definition order.
flat-arglist (function).
Next: Indexes, Previous: Packages, Up: The defmemo Reference Manual [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
Next: Internals, Previous: Definitions, Up: Definitions [Contents][Index]
Next: Ordinary functions, Previous: Public Interface, Up: Public Interface [Contents][Index]
Construct defun with body wrapped into memoizing hash table. Put the latter under :memo property of name.
Previous: Macros, Up: Public Interface [Contents][Index]
Reset memoizing hash table.
Get memoizing hash table.
Replace memoizing hash of symbol with value.
Previous: Definitions, Up: The defmemo Reference Manual [Contents][Index]
Jump to: | (
C D F G M |
---|
Jump to: | (
C D F G M |
---|
Jump to: | D F P S |
---|
Jump to: | D F P S |
---|