diff options
| -rw-r--r-- | lisp/emacs-lisp/map.el | 10 | ||||
| -rw-r--r-- | lisp/emacs-lisp/seq.el | 11 |
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 | |||
| 49 | Matches if the object is a map (list, hash-table or array), and | 50 | Matches if the object is a map (list, hash-table or array), and |
| 50 | binds values from ARGS to their corresponding elements of the map. | 51 | each PATTERN matches the corresponding elements of the map. |
| 52 | |||
| 53 | Supernumerary elements of the map are ignore if less ARGS are | ||
| 54 | given, and the match does not fail. | ||
| 51 | 55 | ||
| 52 | ARGS can be a list elements of the form (KEY PAT), in which case | 56 | ARGS can be a list of the form (KEY PAT), in which case KEY in an |
| 53 | KEY in an unquoted form. | 57 | unquoted form. |
| 54 | 58 | ||
| 55 | ARGS can also be a list of symbols, which stands for ('SYMBOL | 59 | ARGS can also be a list of symbols, which stands for ('SYMBOL |
| 56 | SYMBOL)." | 60 | SYMBOL)." |
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 | |||
| 76 | Matches if the object is a sequence (list, string or vector), and | 77 | Matches if the object is a sequence (list, string or vector), and |
| 77 | binds each element of ARGS to the corresponding element of the | 78 | each PATTERN matches the corresponding element of the sequence. |
| 78 | sequence." | 79 | |
| 80 | Supernumerary elements of the sequence are ignore if less | ||
| 81 | PATTERNS 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. |