From: Lars Ingebrigtsen Date: Mon, 4 Oct 2021 11:23:18 +0000 (+0200) Subject: Document with-memoization X-Git-Tag: emacs-29.0.90~3671^2~671 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=43c2cb0a13343fe366452eea50eb4b36eee3c403;p=emacs.git Document with-memoization * doc/misc/cl.texi (Modify Macros): Document with-memoization. --- diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index a6c3c32c0eb..1e5d40b0377 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi @@ -1245,6 +1245,12 @@ blocks for other macros like @code{cl-incf}, and @code{cl-pushnew}. The @code{cl-letf} and @code{cl-letf*} macros are used in the processing of symbol macros; @pxref{Macro Bindings}. +@defmac with-memoization @var{place} @var{code}@dots{} +This macro provides a simple way to do memoization. @var{code} is +evaluated and then stashed in @var{place}. If @var{place}'s value is +non-@code{nil}, return that value instead of evaluating @var{code}. +@end defmac + @node Variable Bindings @section Variable Bindings diff --git a/etc/NEWS b/etc/NEWS index 7b4a29e1b66..ef8d95af0ba 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -78,6 +78,8 @@ The new ':doc-spec-function' element can be used to compute the mode (instead of at load time). ** subr-x + ++++ *** New macro 'with-memoization' provides a very primitive form of memoization