Skip to content

Commit

Permalink
Correction to definition of focus functions
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhkay committed Apr 15, 2024
1 parent 4a19a16 commit 78e5d53
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions specifications/xquery-40/src/expressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9902,12 +9902,13 @@ return $incrementors[2](4)]]></eg>
and <termref def="dt-mapping-arrow-operator"/>.
For example, <code>$s => tokenize() =!> fn { `"{.}"` }()</code> first tokenizes the string <code>$s</code>,
then wraps each token in double quotation marks.</p>
<p>The expression <code>function { EXPR }</code> (or <code>fn { EXPR }</code>) is a syntactic shorthand for the expression
<code>function($Z as item()*) as item()* { $Z ! (EXPR) }</code>, where <code>$Z</code> is a variable name that is
otherwise unused. Note that the function body (<code>EXPR</code>) is evaluated with a <termref def="dt-fixed-focus"/>:
the context position and context size will always be 1 (one).</p>
<ednote><date>2023-09-14</date><edtext>TODO: The above no longer works. We don't currently have any construct (other than this one) that sets
the context value to something other than a singleton.</edtext></ednote>
<p>The result of calling the <code>function { EXPR }</code> (or <code>fn { EXPR }</code>), with
a single argument whose value is <var>$Z</var> arguments, is obtained by evaluating <code>EXPR</code>
with a dynamic context in which the context value is <var>$Z</var>, the context position is 1 (one),
and the context size is 1 (one).</p>

<p>For example, the expression <code>every(1 to 10, fn{. gt 0})</code> returns <code>true</code>.</p>

</div4>


Expand Down

0 comments on commit 78e5d53

Please sign in to comment.