diff --git a/specifications/xpath-functions-40/src/function-catalog.xml b/specifications/xpath-functions-40/src/function-catalog.xml
index 5a579bdaa..a10f156ca 100644
--- a/specifications/xpath-functions-40/src/function-catalog.xml
+++ b/specifications/xpath-functions-40/src/function-catalog.xml
@@ -31345,7 +31345,7 @@ path with an explicit file:
scheme.
file:
scheme.
Produces the complete (ordered) sequence of all partial results from every new value - the accumulator is assigned to during the evaluation of fn:fold-left.
+Produces the complete (ordered) sequence of all intermediate
+ results of an evaluation of fn:fold-left
.
The function is equivalent to the following implementation in XPath (return clause added in comments for completeness):
+The result of the function is the value of the expression:
+As a consequence of the function signature and the function calling rules, a type error
- occurs if the supplied function $action
cannot be applied to two arguments, where
- the first argument is either the value of $zero
or the result of a previous
- application of $action
, and the second
- is any single item from the sequence $input
.
See fn:fold-left
: errors are raised in the same situations.
Note that each intermediate result is placed in a separate singleton array. - This is necessary because we cannot represent a sequence of results, some or all of which are - a sequence - that is "sequence of sequences" as just a single sequence. -
-A practical implementation might be expected to evaluate the result + incrementally in a single pass of the input; the equivalent expression + given in the rules above is provided purely for formal specification + purposes.
+Each intermediate result is placed in a separate array. The number of arrays
+ in the result is the same as the number of items in $input
.
The fact that the function has the same signature as fn:fold-left
+ means that this function can conveniently be used to study the behavior of
+ an call on fn:fold-left
with the same arguments, perhaps for
+ diagnostic purposes.
Produces the complete (ordered) sequence of all partial results from every new value - the accumulator is assigned to during the evaluation of fn:fold-right.
+Produces the complete (ordered) sequence of all intermediate
+ results of an evaluation of fn:fold-right
.
The function is equivalent to the following implementation in XPath (return clause in comments added for completeness):
+The result of the function is the value of the expression:
+ +As a consequence of the function signature and the function calling rules, a type error
- occurs if the supplied function $action
cannot be applied to two arguments, where
- the first argument is any item in the sequence $input
, and the second is either
- the value of $zero
or the result of a previous application of
- $action
.
See fn:fold-left
: errors are raised in the same situations.
Note that each intermediate result is placed in a separate singleton array. - This is necessary because we cannot represent a sequence of results, some or all of which are - a sequence - that is "sequence of sequences" as just a single sequence. -
-A practical implementation might be expected to evaluate the result + incrementally in a single right-to-left pass of the input; the equivalent expression + given in the rules above is provided purely for formal specification + purposes.
+Each intermediate result is placed in a separate array. The number of arrays
+ in the result is the same as the number of items in $input
.
The fact that the function has the same signature as fn:fold-right
+ means that this function can conveniently be used to study the behavior of
+ an call on fn:fold-right
with the same arguments, perhaps for
+ diagnostic purposes.