The defmemo Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The defmemo Reference Manual

This is the defmemo Reference Manual, version 1.5, generated automatically by Declt version 2.3 "Robert April" on Wed Mar 14 03:48:06 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

Defmemo

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.

Usage

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: , Previous: , Up: Top   [Contents][Index]

2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 defmemo

Author

Orivej Desh <orivej@gmx.fr>

License

Unlicense <http://unlicense.org/UNLICENSE>

Description

Memoizing defun

Version

1.5

Dependencies
Source

defmemo.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

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


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 defmemo.asd

Location

defmemo.asd

Systems

defmemo (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 defmemo/package.lisp

Parent

defmemo (system)

Location

package.lisp

Packages

defmemo


Previous: , Up: Lisp files   [Contents][Index]

3.1.3 defmemo/defmemo.lisp

Dependency

package.lisp (file)

Parent

defmemo (system)

Location

defmemo.lisp

Exported Definitions
Internal Definitions

flat-arglist (function)


Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 defmemo

Source

package.lisp (file)

Use List
Exported Definitions
Internal Definitions

flat-arglist (function)


Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

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


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Macros

Macro: defmemo NAME ARGS &body BODY

Construct defun with body wrapped into memoizing hash table. Put the latter under :memo property of name.

Package

defmemo

Source

defmemo.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Functions

Function: clear-memo SYMBOL

Reset memoizing hash table.

Package

defmemo

Source

defmemo.lisp (file)

Function: get-memo SYMBOL

Get memoizing hash table.

Package

defmemo

Source

defmemo.lisp (file)

Writer

(setf get-memo) (function)

Function: (setf get-memo) VALUE SYMBOL

Replace memoizing hash of symbol with value.

Package

defmemo

Source

defmemo.lisp (file)

Reader

get-memo (function)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Functions

Function: flat-arglist ARGS

Convert ordinary lambda list into funcallable list.

Package

defmemo

Source

defmemo.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   D   F   L  
Index Entry  Section

D
defmemo.asd: The defmemo<dot>asd file
defmemo/defmemo.lisp: The defmemo/defmemo<dot>lisp file
defmemo/package.lisp: The defmemo/package<dot>lisp file

F
File, Lisp, defmemo.asd: The defmemo<dot>asd file
File, Lisp, defmemo/defmemo.lisp: The defmemo/defmemo<dot>lisp file
File, Lisp, defmemo/package.lisp: The defmemo/package<dot>lisp file

L
Lisp File, defmemo.asd: The defmemo<dot>asd file
Lisp File, defmemo/defmemo.lisp: The defmemo/defmemo<dot>lisp file
Lisp File, defmemo/package.lisp: The defmemo/package<dot>lisp file

Jump to:   D   F   L  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (  
C   D   F   G   M  
Index Entry  Section

(
(setf get-memo): Exported functions

C
clear-memo: Exported functions

D
defmemo: Exported macros

F
flat-arglist: Internal functions
Function, (setf get-memo): Exported functions
Function, clear-memo: Exported functions
Function, flat-arglist: Internal functions
Function, get-memo: Exported functions

G
get-memo: Exported functions

M
Macro, defmemo: Exported macros

Jump to:   (  
C   D   F   G   M  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables


Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   D   P   S  
Index Entry  Section

D
defmemo: The defmemo system
defmemo: The defmemo package

P
Package, defmemo: The defmemo package

S
System, defmemo: The defmemo system

Jump to:   D   P   S