summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/lispref/sequences.texi9
-rw-r--r--lisp/emacs-lisp/seq.el8
2 files changed, 12 insertions, 5 deletions
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi
index ca52369bd0c..952834bd4e3 100644
--- a/doc/lispref/sequences.texi
+++ b/doc/lispref/sequences.texi
@@ -658,8 +658,13 @@ for which @var{predicate} returns @code{nil}.
@var{initial-value} and the first element of @var{sequence}, then calling
@var{function} with that result and the second element of @var{sequence},
then with that result and the third element of @var{sequence}, etc.
-@var{function} should be a function of two arguments. If
-@var{sequence} is empty, this returns @var{initial-value} without
+@var{function} should be a function of two arguments.
+
+@var{function} is called with two arguments. @var{intial-value}
+(and then the accumulated value) is used as the first argument, and
+the elements in @var{sequence} are used for the second argument.
+
+If @var{sequence} is empty, this returns @var{initial-value} without
calling @var{function}.
@example
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index e3037a71901..42b145da2fd 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -336,9 +336,11 @@ list."
"Reduce the function FUNCTION across SEQUENCE, starting with INITIAL-VALUE.
Return the result of calling FUNCTION with INITIAL-VALUE and the
-first element of SEQUENCE, then calling FUNCTION with that result and
-the second element of SEQUENCE, then with that result and the third
-element of SEQUENCE, etc.
+first element of SEQUENCE, then calling FUNCTION with that result
+and the second element of SEQUENCE, then with that result and the
+third element of SEQUENCE, etc. FUNCTION will be called with
+INITIAL-VALUE (and then the accumulated value) as the first
+argument, and the elements from SEQUENCE as the second argument.
If SEQUENCE is empty, return INITIAL-VALUE and FUNCTION is not called."
(if (seq-empty-p sequence)