Function: cond-let--and-let*

cond-let--and-let* is a macro defined in cond-let.el.

Signature

(cond-let--and-let* VARLIST &optional BODYFORM)

Documentation

Bind according to VARLIST until one yields nil, else evaluate BODYFORM.

Each element of VARLIST is a list (SYMBOL VALUEFORM), which binds SYMBOL to the value of VALUEFORM. Each VALUEFORM can refer to symbols already bound by this VARLIST (as for let*).

Evaluate VALUEFORMs until on of them yields nil. If that happens return nil, and evaluate neither the remaining VALUEFORMs nor BODYFORM. If all VALUEFORMs yield non-nil, evaluate BODYFORM with the bindings in effect, and return its value; or if there is no BODYFORM, the value of the last VALUEFORM.

Source Code

;; Defined in ~/.emacs.d/elpa/cond-let-20260201.1500/cond-let.el
;;; And

(defmacro cond-let--and-let* (varlist &optional bodyform)
  "Bind according to VARLIST until one yields nil, else evaluate BODYFORM.

Each element of VARLIST is a list (SYMBOL VALUEFORM), which binds SYMBOL
to the value of VALUEFORM.  Each VALUEFORM can refer to symbols already
bound by this VARLIST (as for `let*').

Evaluate VALUEFORMs until on of them yields nil.  If that happens return
nil, and evaluate neither the remaining VALUEFORMs nor BODYFORM.  If all
VALUEFORMs yield non-nil, evaluate BODYFORM with the bindings in effect,
and return its value; or if there is no BODYFORM, the value of the last
VALUEFORM."
  (declare (indent 1)
           (debug ((&rest (symbolp form)) form)))
  (pcase-let ((`(,varlist ,lastvar)
               (cond-let--prepare-varlist varlist)))
    `(let* ,varlist
       ,(if bodyform
            `(and ,lastvar ,bodyform)
          lastvar))))