From 43c2cb0a13343fe366452eea50eb4b36eee3c403 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 4 Oct 2021 13:23:18 +0200 Subject: [PATCH] Document with-memoization * doc/misc/cl.texi (Modify Macros): Document with-memoization. --- doc/misc/cl.texi | 6 ++++++ etc/NEWS | 2 ++ 2 files changed, 8 insertions(+) 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 -- 2.39.5