From b7943ebbfe4c3233397e7e0707ed32595d08616f Mon Sep 17 00:00:00 2001
From: Michael Kay
Date: Wed, 8 May 2024 18:35:17 +0100
Subject: [PATCH] Add and use definition of sequence concatenation
---
.../src/function-catalog.xml | 17 +++++++++------
specifications/xquery-40/src/expressions.xml | 21 +++++++++++++------
2 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/specifications/xpath-functions-40/src/function-catalog.xml b/specifications/xpath-functions-40/src/function-catalog.xml
index 94764e7ce..b202df329 100644
--- a/specifications/xpath-functions-40/src/function-catalog.xml
+++ b/specifications/xpath-functions-40/src/function-catalog.xml
@@ -4161,7 +4161,8 @@ translate(value := '٢٠٢٣', replace := '٠١٢٣٤٥٦٧٨٩', with := '01234
the input sequence may be supplied using multiple arguments. In addition
the parameter is declared optional, so a call with no arguments is also permitted.
- The result of the function is obtained by forming the sequence-concatenation of the supplied
+
The result of the function is obtained by forming the
+ sequence concatenation of the supplied
argument values and applying the function fn:string-join#0
to the result.
If XPath 1.0 compatibility mode is set to true in the static context of a
@@ -20831,7 +20832,9 @@ declare function transitive-closure (
If duplicate keys are present, the result map includes an entry for the key whose
- associated value is the sequence-concatenation of all the values associated with the key,
+ associated value is the
+ sequence concatenation
+ of all the values associated with the key,
retaining order based on the order of maps in the $maps
argument.
The key value in the result map that corresponds to such a set of duplicates must
be the The value of the existing map is unchanged; the returned map
contains all the entries from $week
, with one entry replaced by a
new entry. Both input maps contain an entry with the key 6
; the
- entry that appears in the result is the sequence-concatenation of the entries
+ entry that appears in the result is the sequence concatenation of the entries
in the input maps, retaining order.
@@ -22260,7 +22263,9 @@ fold-left($input, {}, fn($map, $item, $pos) {
The default function for both $keys
and $value
is the identity function.
Although it is permitted to default both, this serves little purpose: usually at least one of these arguments
will be supplied.
- The default action for combining entries with duplicate keys is to perform a sequence-concatenation of the corresponding values,
+
The default action for combining entries with duplicate keys is to perform a
+ sequence concatenation
+ of the corresponding values,
equivalent to the duplicates: combine
option on map:merge
. Other potentially useful
functions for combining duplicates include:
@@ -27255,10 +27260,10 @@ declare function flatten(
focus-independent
- Returns the sequence-concatenation of the members of an array.
+ Returns the sequence concatenation of the members of an array.
- The function returns the sequence-concatenation of the members of
+
The function returns the sequence concatenation of the members of
$array
, retaining order.
More formally, it returns the result of array:members($array)?value
.
diff --git a/specifications/xquery-40/src/expressions.xml b/specifications/xquery-40/src/expressions.xml
index 796381b74..7356457cb 100644
--- a/specifications/xquery-40/src/expressions.xml
+++ b/specifications/xquery-40/src/expressions.xml
@@ -12237,6 +12237,13 @@ in the sequence (1, 2, 3)
.
new sequence is created by concatenating two or more input sequences, the new
sequence contains all the items of the input sequences and its length is the
sum of the lengths of the input sequences.
+
+ The
+ sequence concatenation of a number of sequences S/1, S/2, ... S/n
+ is defined to be the sequence formed from the items of S/1, followed by the items
+ from S/2, and so on, retaining order. The comma operator returns the sequence
+ concatenation of its two operands; repeated application (for example $s1, $s2, $s3, $s4
)
+ delivers the sequence concatenation of multiple sequences.
In places where the grammar calls for ExprSingle, such as the arguments of a function call, any expression that contains a top-level comma operator must be enclosed in parentheses.
@@ -16907,7 +16914,7 @@ processing with JSON processing.
Similarly, given $M
as a map
{ "X": ("a", "b"), "Y": ("c", "d"), "Z": ("e", "f") }
,
- some example Lookup expressions are as follows. Note that because maps are unordered,
+ some example lookup expressions are as follows. Note that because maps are unordered,
the results are not necessarily in the order shown.
@@ -17059,7 +17066,8 @@ processing with JSON processing.
If the modifier is items
(explicitly or by default), the result of
$V?items::KS
is the same as the result of
- $V?pairs::KS ! map:get(., "value")
.
+ $V?pairs::KS ! map:get(., "value")
; that is,
+ it is the of the value parts.
If the modifier is values
, the result of
$V?values::KS
is the same as the result of
@@ -17319,7 +17327,8 @@ declare function recursive-content($item as item()) as record(key, value)* {
If the modifier is items
(explicitly or by default), the result of
$V??items::KS
is the same as the result of
- $V??pairs::KS ! map:get(., "value")
.
+ $V??pairs::KS ! map:get(., "value")
; that is,
+ it is the of the value parts.
If the modifier is values
, the result of
$V??values::KS
is the same as the result of
@@ -21621,8 +21630,8 @@ raised dynamic context. The sequences resulting from all the
evaluations of E2
are combined as follows: Every evaluation
of E2
returns a (possibly empty) sequence of items.
- These sequences are concatenated and returned. If ordering mode is ordered, the
+ The final result is the of these sequences.
+ If ordering mode is ordered, the
The returned sequence preserves the orderings within and among the subsequences generated by the evaluations of E2
.
@@ -21656,7 +21665,7 @@ raised
Additional processing |
Duplicate elimination and document ordering |
- Simple sequence concatenation |
+ Simple |