emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 30e5183 2/3: * lisp/emacs-lisp/map.el (map-let): Be


From: Nicolas Petton
Subject: [Emacs-diffs] master 30e5183 2/3: * lisp/emacs-lisp/map.el (map-let): Better docstring.
Date: Fri, 05 Jun 2015 23:55:47 +0000

branch: master
commit 30e518379e1033ca2f37f8c82b38c4647f7dd424
Author: Nicolas Petton <address@hidden>
Commit: Nicolas Petton <address@hidden>

    * lisp/emacs-lisp/map.el (map-let): Better docstring.
---
 lisp/emacs-lisp/map.el |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el
index a0792d9..85f6bca 100644
--- a/lisp/emacs-lisp/map.el
+++ b/lisp/emacs-lisp/map.el
@@ -47,20 +47,25 @@
 (pcase-defmacro map (&rest args)
   "pcase pattern matching map elements.
 Matches if the object is a map (list, hash-table or array), and
-binds values from ARGS to the corresponding element of the map.
+binds values from ARGS to their corresponding elements of the map.
 
-ARGS can be a list elements of the form (KEY . PAT) or elements
-of the form SYMBOL, which stands for (SYMBOL . SYMBOL)."
+ARGS can be a list elements of the form (KEY PAT) or elements
+of the form SYMBOL, which stands for ('SYMBOL SYMBOL)."
   `(and (pred map-p)
         ,@(map--make-pcase-bindings args)))
 
-(defmacro map-let (args map &rest body)
-  "Bind the variables in ARGS to the elements of MAP then evaluate BODY.
+(defmacro map-let (keys map &rest body)
+  "Bind the variables in KEYS to the elements of MAP then evaluate BODY.
 
-ARGS can be an alist of key/binding pairs or a list of keys.  MAP
-can be a list, hash-table or array."
+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) pairs, in which case
+KEY is not quoted.
+
+MAP can be a list, hash-table or array."
   (declare (indent 2) (debug t))
-  `(pcase-let ((,(map--make-pcase-patterns args) ,map))
+  `(pcase-let ((,(map--make-pcase-patterns keys) ,map))
      ,@body))
 
 (defmacro map--dispatch (spec &rest args)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]