Function: map-let

map-let is a macro defined in map.el.gz.

Signature

(map-let KEYS MAP &rest BODY)

Documentation

Bind the variables in KEYS to the elements of MAP, then evaluate BODY.

KEYS can be a list of symbols, in which case each element will be bound to the looked up value in MAP.

KEYS can also be a list of (KEY VARNAME [DEFAULT]) sublists, in which case KEY and DEFAULT are unquoted forms.

MAP can be an alist, plist, hash-table, or array.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/map.el.gz
(defmacro map-let (keys map &rest body)
  "Bind the variables in KEYS to the elements of MAP, then evaluate BODY.

KEYS can be a list of symbols, in which case each element will be
bound to the looked up value in MAP.

KEYS can also be a list of (KEY VARNAME [DEFAULT]) sublists, in
which case KEY and DEFAULT are unquoted forms.

MAP can be an alist, plist, hash-table, or array."
  (declare (indent 2)
           (debug ((&rest &or symbolp ([form symbolp &optional form]))
                   form body)))
  `(pcase-let ((,(map--make-pcase-patterns keys) ,map))
     ,@body))