]> code.delx.au - gnu-emacs/commitdiff
Better documentation for cl-reduce (bug#24014)
authorNicolas Petton <nicolas@petton.fr>
Mon, 18 Jul 2016 12:12:50 +0000 (14:12 +0200)
committerNicolas Petton <nicolas@petton.fr>
Mon, 18 Jul 2016 12:17:28 +0000 (14:17 +0200)
* lisp/emacs-lisp/cl-seq.el (cl-reduce): Explain what reducing means.

lisp/emacs-lisp/cl-seq.el

index 21aec6cdfcdc75b11d641ad9bf7355404e6637df..443a147b3d223badf4ef406670df77cb3eda70d9 100644 (file)
 (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)))