summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/cl-seq.el
diff options
context:
space:
mode:
authorNicolas Petton <nicolas@petton.fr>2016-07-18 14:12:50 +0200
committerNicolas Petton <nicolas@petton.fr>2016-07-18 14:17:28 +0200
commit1879b9055eaf5c9f3fd126c2c21450cdd8c83262 (patch)
treee64cf057985a4b4c4d5ad6cd9b9d024adaf185c1 /lisp/emacs-lisp/cl-seq.el
parent85b3eca57a5ae5335c11b157bb481cf8f7a35684 (diff)
downloademacs-1879b9055eaf5c9f3fd126c2c21450cdd8c83262.tar.gz
emacs-1879b9055eaf5c9f3fd126c2c21450cdd8c83262.tar.bz2
emacs-1879b9055eaf5c9f3fd126c2c21450cdd8c83262.zip
Better documentation for cl-reduce (bug#24014)
* lisp/emacs-lisp/cl-seq.el (cl-reduce): Explain what reducing means.
Diffstat (limited to 'lisp/emacs-lisp/cl-seq.el')
-rw-r--r--lisp/emacs-lisp/cl-seq.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/cl-seq.el b/lisp/emacs-lisp/cl-seq.el
index 21aec6cdfcd..443a147b3d2 100644
--- a/lisp/emacs-lisp/cl-seq.el
+++ b/lisp/emacs-lisp/cl-seq.el
@@ -116,6 +116,16 @@
(defun cl-reduce (cl-func cl-seq &rest cl-keys)
"Reduce two-argument FUNCTION across SEQ.
\nKeywords supported: :start :end :from-end :initial-value :key
+
+Return the result of calling FUNCTION with the first and the
+second element of SEQ, then calling FUNCTION with that result and
+the third element of SEQ, then with that result and the fourth
+element of SEQ, etc.
+
+If :INITIAL-VALUE is specified, it is added to the front of SEQ.
+If SEQ is empty, return :INITIAL-VALUE and FUNCTION is not
+called.
+
\n(fn FUNCTION SEQ [KEYWORD VALUE]...)"
(cl--parsing-keywords (:from-end (:start 0) :end :initial-value :key) ()
(or (listp cl-seq) (setq cl-seq (append cl-seq nil)))