Skip to content

Commit

Permalink
Merge pull request #1157 from michaelhkay/1135-definition-of-focus-fu…
Browse files Browse the repository at this point in the history
…nctions

1135 Correction to definition of focus functions
  • Loading branch information
ndw authored Apr 23, 2024
2 parents 9f3fdc6 + 78e5d53 commit cf1a778
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 @@ -9931,12 +9931,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 cf1a778

Please sign in to comment.