[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master b5e2d74: Better docstrings in seq.el and map.el
From: |
Nicolas Petton |
Subject: |
[Emacs-diffs] master b5e2d74: Better docstrings in seq.el and map.el |
Date: |
Wed, 14 Oct 2015 07:40:16 +0000 |
branch: master
commit b5e2d7495017e0d87de331f41838810b72730942
Author: Nicolas Petton <address@hidden>
Commit: Nicolas Petton <address@hidden>
Better docstrings in seq.el and map.el
* lisp/emacs-lisp/map.el:
* lisp/emacs-lisp/seq.el: Improve the docstring for the pcase patterns.
---
lisp/emacs-lisp/map.el | 10 +++++++---
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 ea56efe..7564463 100644
--- a/lisp/emacs-lisp/map.el
+++ b/lisp/emacs-lisp/map.el
@@ -46,11 +46,15 @@
(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 their corresponding elements of the map.
+each PATTERN matches the corresponding elements of the map.
+
+Supernumerary elements of the map are ignore if less ARGS are
+given, and the match does not fail.
-ARGS can be a list elements of the form (KEY PAT), in which case
-KEY in an unquoted form.
+ARGS can be a list of the form (KEY PAT), in which case KEY in an
+unquoted form.
ARGS can also be a list of symbols, which stands for ('SYMBOL
SYMBOL)."
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index a63447d..d7c9c74 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.
,@body)
,(cadr spec)))
-(pcase-defmacro seq (&rest args)
+(pcase-defmacro seq (&rest patterns)
"pcase pattern matching sequence elements.
+
Matches if the object is a sequence (list, string or vector), and
-binds each element of ARGS to the corresponding element of the
-sequence."
+each PATTERN matches the corresponding element of the sequence.
+
+Supernumerary elements of the sequence are ignore if less
+PATTERNS are given, and the match does not fail."
`(and (pred seq-p)
- ,@(seq--make-pcase-bindings args)))
+ ,@(seq--make-pcase-bindings patterns)))
(defmacro seq-let (args seq &rest body)
"Bind the variables in ARGS to the elements of SEQ then evaluate BODY.
- [Emacs-diffs] master b5e2d74: Better docstrings in seq.el and map.el,
Nicolas Petton <=