summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorNicolas Petton <nicolas@petton.fr>2015-02-06 15:57:54 +0100
committerNicolas Petton <nicolas@petton.fr>2015-02-06 16:00:01 +0100
commit58c098199aca5bbd782e36ff629866538cb08e32 (patch)
tree7e29a63df14db521834add628d1f6c08ccba24d8 /lisp
parentc4a0eff0112298de0a97b63e4e22826bf2b4126c (diff)
downloademacs-58c098199aca5bbd782e36ff629866538cb08e32.tar.gz
Better docstring for seq.el functions
* lisp/emacs-lisp/seq.el: Better docstring for seq.el functions
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/emacs-lisp/seq.el18
2 files changed, 13 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0cd2a4d04e8..ea92da89ef2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,6 +1,8 @@
2015-02-06 Nicolas Petton <nicolas@petton.fr>
* emacs-lisp/seq.el (seq-mapcat, seq-partition, seq-group-by): New functions.
+ * emacs-lisp/seq.el (seq-drop-while, seq-take-while, seq-count)
+ (seq--drop-list, seq--take-list, seq--take-while-list): Better docstring.
2015-02-06 Artur Malabarba <bruce.connor.am@gmail.com>
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index cd45989eca8..025d94e10b9 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -92,14 +92,14 @@ returned."
(seq-subseq seq 0 (min (max n 0) (seq-length seq)))))
(defun seq-drop-while (pred seq)
- "Return a sequence, from the first element for which (PRED element) is nil, of SEQ.
+ "Return a sequence from the first element for which (PRED element) is nil in SEQ.
The result is a sequence of the same type as SEQ."
(if (listp seq)
(seq--drop-while-list pred seq)
(seq-drop seq (seq--count-successive pred seq))))
(defun seq-take-while (pred seq)
- "Return a sequence of the successive elements for which (PRED element) is non-nil in SEQ.
+ "Return the successive elements for which (PRED element) is non-nil in SEQ.
The result is a sequence of the same type as SEQ."
(if (listp seq)
(seq--take-while-list pred seq)
@@ -152,7 +152,7 @@ If SEQ is empty, return INITIAL-VALUE and FUNCTION is not called."
t))
(defun seq-count (pred seq)
- "Return the number of elements for which (PRED element) returns non-nil in seq."
+ "Return the number of elements for which (PRED element) is non-nil in SEQ."
(let ((count 0))
(seq-doseq (elt seq)
(when (funcall pred elt)
@@ -258,14 +258,16 @@ keys. Keys are compared using `equal'."
nil)))
(defun seq--drop-list (list n)
- "Optimized version of `seq-drop' for lists."
+ "Return a list from LIST without its first N elements.
+This is an optimization for lists in `seq-drop'."
(while (and list (> n 0))
(setq list (cdr list)
n (1- n)))
list)
(defun seq--take-list (list n)
- "Optimized version of `seq-take' for lists."
+ "Return a list from LIST made of its first N elements.
+This is an optimization for lists in `seq-take'."
(let ((result '()))
(while (and list (> n 0))
(setq n (1- n))
@@ -273,13 +275,15 @@ keys. Keys are compared using `equal'."
(nreverse result)))
(defun seq--drop-while-list (pred list)
- "Optimized version of `seq-drop-while' for lists."
+ "Return a list from the first element for which (PRED element) is nil in LIST.
+This is an optimization for lists in `seq-drop-while'."
(while (and list (funcall pred (car list)))
(setq list (cdr list)))
list)
(defun seq--take-while-list (pred list)
- "Optimized version of `seq-take-while' for lists."
+ "Return the successive elements for which (PRED element) is non-nil in LIST.
+This is an optimization for lists in `seq-take-while'."
(let ((result '()))
(while (and list (funcall pred (car list)))
(push (pop list) result))