Skip to content

cireu/emacs-memoize

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 (n)
  (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.

To restore the original definition of a memoized function symbol (not a lambda or closure), use memoize-restore:

(memoize 'my-function)
(memoize-restore 'my-function)

About

Elisp memoization functions

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Emacs Lisp 96.6%
  • Makefile 3.4%