core/autoload/memoize: add autoload cookies

This commit is contained in:
Henrik Lissner 2017-03-01 23:45:39 -05:00
parent 53d67fb622
commit 25091ee375

View file

@ -1,6 +1,7 @@
;;; memoize.el
(provide 'doom-lib-memoize)
;;;###autoload
(defvar doom-memoized-table (make-hash-table :test 'equal :size 10)
"A lookup table containing memoized functions. The keys are argument lists,
and the value is the function's return value.")
@ -14,6 +15,7 @@ and the value is the function's return value.")
(or (gethash key doom-memoized-table)
(puthash key (apply ',func args) doom-memoized-table))))))
;;;###autoload
(defmacro def-memoized! (name arglist &rest body)
"Create a memoize'd function. NAME, ARGLIST, DOCSTRING and BODY
have the same meaning as in `defun'."