Elisp memoization functions
Emacs Lisp
Switch branches/tags
Nothing to show
Latest commit b55eab0 Apr 21, 2013 @ahyatt ahyatt Merge branch 'master' into origin-buffer-memoization
Conflicts:
	memoize-test.el
Permalink
Failed to load latest commit information.
README.md
UNLICENSE
memoize-test.el
memoize.el

README.md

Elisp memoization functions

See the header in the source file for details. It's very easy to use:

(require 'memoize)

(memoize 'my-function)

The macro defmemoize is also provided to directly create memoized functions:

(defmemoize my-expensive-function (x)
  (if (zerop n)
      1
    (* n (my-expensive-function (1- n)))))

Some functions are run over buffer contents, and need to be cached only so long as the buffer contents do not change. For these use-cases, we have the function memoize-by-buffer-contents as well as the defmemoize-by-buffer-contents macro.