Function: pcase-let*-strict

pcase-let*-strict is an autoloaded macro defined in pcase.el.gz.

Signature

(pcase-let*-strict BINDINGS &rest BODY)

Documentation

Like pcase-let*, but signal an error when a pattern does not match.

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.

View in manual

Probably introduced at or before Emacs version 32.1.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/pcase.el.gz
;;;###autoload
(defmacro pcase-let*-strict (bindings &rest body)
  "Like `pcase-let*', but signal an error when a pattern does not match.
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 t)))
        (puthash bindings (cons body expansion) pcase--memoize)
        expansion))))