Function: pcase-let*
pcase-let* is an autoloaded macro defined in pcase.el.gz.
Signature
(pcase-let* BINDINGS &rest BODY)
Documentation
Like let*, but supports destructuring BINDINGS using pcase patterns.
As with pcase-let, BINDINGS are of the form (PATTERN EXP), but the
EXP in each binding in BINDINGS can use the results of the destructuring
bindings that precede it in BINDINGS' order.
Each EXP should match its respective PATTERN (i.e. be of structure compatible to PATTERN); a mismatch may signal an error or may go undetected, binding variables to arbitrary values, such as nil.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/pcase.el.gz
;;;###autoload
(defmacro pcase-let* (bindings &rest body)
"Like `let*', but supports destructuring BINDINGS using `pcase' patterns.
As with `pcase-let', BINDINGS are of the form (PATTERN EXP), but the
EXP in each binding in BINDINGS can use the results of the destructuring
bindings that precede it in BINDINGS' order.
Each EXP should match its respective PATTERN (i.e. be of structure
compatible to PATTERN); a mismatch may signal an error or may go
undetected, binding variables to arbitrary values, such as nil."
(declare (indent 1)
(debug ((&rest (pcase-PAT &optional form)) body)))
(let ((cached (gethash bindings pcase--memoize)))
;; cached = (BODY . EXPANSION)
(if (equal (car cached) body)
(cdr cached)
(let ((expansion (pcase--let* bindings body)))
(puthash bindings (cons body expansion) pcase--memoize)
expansion))))