Sequences
In the XQuery data model, every expression input and output is defined as a sequence of items. Sequences are flat (never nested) and are ordered collections of heterogeneously-typed values. In general, a sequence of a single item is treated as just the single item.
Sequences are formed using the comma operator. Here is a sequence of integers:
1, 2, 3
Parentheses are a general grouping mechanism in XQuery used to disambiguate or group expressions. If you attempt to nest sequences, they are flattened into a single sequence.
(1, 2, (3, 4, (5), 6), 7)
is resolved to:
(1, 2, 3, 4, 5, 6, 7)
As mentioned, sequences are heterogenous:
(1, ‘abc’, false(), 1.234)
