<div dir="ltr">Hi John,<div><br></div><div>Thanks for your reply.  I had discovered that parentheses would allow the query to complete without error, but I struggled to see what rule in the spec my query violated.  Now I see it: the predicate isn't valid in the ArrowFunctionSpecifier, defined at <a href="https://www.w3.org/TR/xquery-31/#doc-xquery31-ArrowFunctionSpecifier">https://www.w3.org/TR/xquery-31/#doc-xquery31-ArrowFunctionSpecifier</a> as:</div><div><br></div><div>  EQName | VarRef | ParenthesizedExpr</div><div><br></div><div>So the parser sees the ParenthesizedExpr in my `tokenize("\.")` and then chokes on the following character, the open square bracket.</div><div><br></div><div>Thanks for helping me see this!</div><div>Joe</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 13, 2017 at 3:44 PM, John Snelson <span dir="ltr"><<a href="mailto:John.Snelson@marklogic.com" target="_blank">John.Snelson@marklogic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The equivalence holds for how it functionally behaves, not for what<br>
grammar the parser allows. You need parentheses:<br>
<br>
("1.2.3" => tokenize("\."))[. < "3"]<br>
<br>
<br>
John<br>
<div><div class="h5"><br>
On 13/04/2017 20:09, Joe Wicentowski wrote:<br>
> Hi all,<br>
><br>
> As I understand the arrow operator<br>
> (<a href="https://www.w3.org/TR/xquery-31/#id-arrow-operator" rel="noreferrer" target="_blank">https://www.w3.org/TR/xquery-<wbr>31/#id-arrow-operator</a>), the following<br>
> query:<br>
><br>
>    "1.2.3" => tokenize("\.")<br>
><br>
> is equivalent to:<br>
><br>
>     tokenize("1.2.3", "\.")<br>
><br>
> If this is so, then can anyone shed light on why appending a predicate<br>
> to the former would raise an error but not so for the latter?  In<br>
> Saxon, eXist, and BaseX, the following expression:<br>
><br>
>    "1.2.3" => tokenize("\.")[. < "3"]<br>
><br>
> raises an error like:<br>
><br>
>    XPST0003: Unexpected token "[" beyond end of query<br>
><br>
> whereas the pre-XQuery 3.1 approach:<br>
><br>
>     tokenize("1.2.3", "\.")[. < "3"]<br>
><br>
> returns the results I'd expect:<br>
><br>
>    ("1", "2")<br>
><br>
> Thanks,<br>
> Joe<br>
</div></div>> ______________________________<wbr>_________________<br>
> <a href="mailto:talk@x-query.com">talk@x-query.com</a><br>
> <a href="http://x-query.com/mailman/listinfo/talk" rel="noreferrer" target="_blank">http://x-query.com/mailman/<wbr>listinfo/talk</a><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
John Snelson, Principal Engineer              <a href="http://twitter.com/jpcs" rel="noreferrer" target="_blank">http://twitter.com/jpcs</a><br>
MarkLogic Corporation                         <a href="http://www.marklogic.com" rel="noreferrer" target="_blank">http://www.marklogic.com</a><br>
<br>
______________________________<wbr>_________________<br>
<a href="mailto:talk@x-query.com">talk@x-query.com</a><br>
<a href="http://x-query.com/mailman/listinfo/talk" rel="noreferrer" target="_blank">http://x-query.com/mailman/<wbr>listinfo/talk</a><br>
</font></span></blockquote></div><br></div>