Commit ace25f20 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen

Clarify the seq-reduce documentation

* doc/lispref/sequences.texi (Sequence Functions): Ditto.

* lisp/emacs-lisp/seq.el (seq-reduce): Clarify the order of the
arguments (bug#43995).
parent 7d598e28
Pipeline #7350 passed with stage
in 102 minutes and 59 seconds
...@@ -658,8 +658,13 @@ for which @var{predicate} returns @code{nil}. ...@@ -658,8 +658,13 @@ for which @var{predicate} returns @code{nil}.
@var{initial-value} and the first element of @var{sequence}, then calling @var{initial-value} and the first element of @var{sequence}, then calling
@var{function} with that result and the second element of @var{sequence}, @var{function} with that result and the second element of @var{sequence},
then with that result and the third element of @var{sequence}, etc. then with that result and the third element of @var{sequence}, etc.
@var{function} should be a function of two arguments. If @var{function} should be a function of two arguments.
@var{sequence} is empty, this returns @var{initial-value} without
@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}. calling @var{function}.
@example @example
......
...@@ -336,9 +336,11 @@ list." ...@@ -336,9 +336,11 @@ list."
"Reduce the function FUNCTION across SEQUENCE, starting with INITIAL-VALUE. "Reduce the function FUNCTION across SEQUENCE, starting with INITIAL-VALUE.
Return the result of calling FUNCTION with INITIAL-VALUE and the Return the result of calling FUNCTION with INITIAL-VALUE and the
first element of SEQUENCE, then calling FUNCTION with that result and first element of SEQUENCE, then calling FUNCTION with that result
the second element of SEQUENCE, then with that result and the third and the second element of SEQUENCE, then with that result and the
element of SEQUENCE, etc. 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 SEQUENCE is empty, return INITIAL-VALUE and FUNCTION is not called."
(if (seq-empty-p sequence) (if (seq-empty-p sequence)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment