Product SiteDocumentation Site

4.2. Sequence Types

All sequences match the sequence type item*.
Example 4.8. The most general sequence type: item*.
{ "foo" : "bar" } instance of item*,
() instance of item*,
([ 1, 2, 3 ], 2, { "foo" : "bar" }, 4)
    instance of item*
Results:
true
true
true

But sequence types can be much more precise than that. In general, a sequence type is made of an item type, as presented above, followed by an occurrence indicator among the following:
Example 4.9. Further sequence types.
( { "foo" : "bar" } , {} ) instance of object*,
() instance of object*,
( [ 1, 2, 3 ] , {} ) instance of json-item+,
[ 1, 2, 3 ] instance of array?,
() instance of array?,
"foo" instance of string
Results:
true
true
true
true
true
true

There is also a special type that matches only empty sequences, denoted () as well:
Example 4.10. Empty sequence type: ()
() instance of ()
Results:
true