On 16/07/2015 10:29, Eliot Kimber wrote: I do see that I can do:
let $array := [()] To create an array with one member that is an empty sequence. My business problem is I need to pass an array of sequences to a recursive function, where each recursion takes the cadr of the array. When the array is empty, recursion stops. So the question is, how to determine that an array is "empty" given that an array must have at least one member. It looks like the answer is "an array is empty when the only member is an empty sequence". Is my analysis correct? No. The grammar is this: [73] ArrayConstructor<http://www.w3.org/TR/xpath-31/#prod-xpath31-ArrayConstructor> ::= SquareArrayConstructor<http://www.w3.org/TR/xpath-31/#doc-xpath31-SquareArrayConstructor> | CurlyArrayConstructor<http://www.w3.org/TR/xpath-31/#doc-xpath31-CurlyArrayConstructor> [74] SquareArrayConstructor<http://www.w3.org/TR/xpath-31/#prod-xpath31-SquareArrayConstructor> ::= "[" (ExprSingle<http://www.w3.org/TR/xpath-31/#doc-xpath31-ExprSingle> ("," ExprSingle<http://www.w3.org/TR/xpath-31/#doc-xpath31-ExprSingle>)*)? "]" [75] CurlyArrayConstructor<http://www.w3.org/TR/xpath-31/#prod-xpath31-CurlyArrayConstructor> ::= "array" "{" Expr<http://www.w3.org/TR/xpath-31/#doc-xpath31-Expr>? "}" The SquareArrayConstructor has parentheses and a "?" operator around the exprSingles inside it, so they are optional and can be left out. Thus you can use "[]" for an empty array. Similarly the CurlyArrayConstructor for a "?" on it's Expr so it can be left out. Thus you can also use "array{}" for an empty array. John -- John Snelson, Lead Engineer http://twitter.com/jpcs MarkLogic Corporation http://www.marklogic.com
_______________________________________________ talk@x-query.com http://x-query.com/mailman/listinfo/talk