Skip to content

djr7C4/emacs-memoize

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fork

I've made this fork since the original repository is no longer maintained as per this discussion. It will be kept usable enough for my packages and configuration though it may not be developed too actively. It currently contains several bug fixes and changes that do not exist in the original repository.

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

 
 
 

Contributors

Languages

  • Emacs Lisp 96.7%
  • Makefile 3.3%