aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/emacs-lisp/map.el10
-rw-r--r--lisp/emacs-lisp/seq.el11
2 files changed, 14 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el
index ea56efefe97..7564463e6c6 100644
--- a/lisp/emacs-lisp/map.el
+++ b/lisp/emacs-lisp/map.el
@@ -46,11 +46,15 @@
46 46
47(pcase-defmacro map (&rest args) 47(pcase-defmacro map (&rest args)
48 "pcase pattern matching map elements. 48 "pcase pattern matching map elements.
49
49Matches if the object is a map (list, hash-table or array), and 50Matches if the object is a map (list, hash-table or array), and
50binds values from ARGS to their corresponding elements of the map. 51each PATTERN matches the corresponding elements of the map.
52
53Supernumerary elements of the map are ignore if less ARGS are
54given, and the match does not fail.
51 55
52ARGS can be a list elements of the form (KEY PAT), in which case 56ARGS can be a list of the form (KEY PAT), in which case KEY in an
53KEY in an unquoted form. 57unquoted form.
54 58
55ARGS can also be a list of symbols, which stands for ('SYMBOL 59ARGS can also be a list of symbols, which stands for ('SYMBOL
56SYMBOL)." 60SYMBOL)."
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index a63447d3243..d7c9c74b2e0 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -71,13 +71,16 @@ Evaluate BODY with VAR bound to each element of SEQ, in turn.
71 ,@body) 71 ,@body)
72 ,(cadr spec))) 72 ,(cadr spec)))
73 73
74(pcase-defmacro seq (&rest args) 74(pcase-defmacro seq (&rest patterns)
75 "pcase pattern matching sequence elements. 75 "pcase pattern matching sequence elements.
76
76Matches if the object is a sequence (list, string or vector), and 77Matches if the object is a sequence (list, string or vector), and
77binds each element of ARGS to the corresponding element of the 78each PATTERN matches the corresponding element of the sequence.
78sequence." 79
80Supernumerary elements of the sequence are ignore if less
81PATTERNS are given, and the match does not fail."
79 `(and (pred seq-p) 82 `(and (pred seq-p)
80 ,@(seq--make-pcase-bindings args))) 83 ,@(seq--make-pcase-bindings patterns)))
81 84
82(defmacro seq-let (args seq &rest body) 85(defmacro seq-let (args seq &rest body)
83 "Bind the variables in ARGS to the elements of SEQ then evaluate BODY. 86 "Bind the variables in ARGS to the elements of SEQ then evaluate BODY.