Skip to content

Commit

Permalink
Add fn:partition, and change a couple of examples
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhkay committed May 5, 2024
1 parent b118cd8 commit 6e789a2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions specifications/xpath-functions-40/src/function-catalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19579,7 +19579,7 @@ chain((1, 2, 3, 4), $product3)
<eg><![CDATA[
declare %private function while-do-helper(
$input as item()*,
$predicate as function(item()*, xs:integer) as xs:boolean,
$predicate as function(item()*, xs:integer) as xs:boolean?,
$action as function(item()*, xs:integer) as item()*,
$pos as xs:integer
) as item()* {
Expand All @@ -19590,7 +19590,7 @@ declare %private function while-do-helper(

declare function while-do(
$input as item()*,
$predicate as function(item()*, xs:integer) as xs:boolean,
$predicate as function(item()*, xs:integer) as xs:boolean?,
$action as function(item()*, xs:integer) as item()*
) as item()* {
while-do-helper($input, $predicate, $action, 1)
Expand Down Expand Up @@ -19729,7 +19729,7 @@ return $result?numbers
declare %private function do-until-helper(
$input as item()*,
$action as function(item()*, xs:integer) as item()*,
$predicate as function(item()*, xs:integer) as xs:boolean,
$predicate as function(item()*, xs:integer) as xs:boolean?,
$pos as xs:integer
) as item()* {
let $result := $action($input, $pos)
Expand All @@ -19743,7 +19743,7 @@ declare %private function do-until-helper(
declare function do-until(
$input as item()*,
$action as function(item()*, xs:integer) as item()*,
$predicate as function(item()*, xs:integer) as xs:boolean
$predicate as function(item()*, xs:integer) as xs:boolean?
) as item()* {
do-until-helper($input, $action, $predicate, 1)
};]]></eg>
Expand Down Expand Up @@ -30646,7 +30646,7 @@ path with an explicit <code>file:</code> scheme.</p>
<fos:signatures>
<fos:proto name="partition" return-type="array(item())*">
<fos:arg name="input" type="item()*"/>
<fos:arg name="split-when" type="function(item()*, item(), xs:integer) as xs:boolean"/>
<fos:arg name="split-when" type="function(item()*, item(), xs:integer) as xs:boolean?"/>
</fos:proto>
</fos:signatures>
<fos:properties>
Expand All @@ -30668,7 +30668,7 @@ path with an explicit <code>file:</code> scheme.</p>
the sequence of arrays.</p>
<p>If the <code>$split-when</code> function returns <code>true</code>, the current partition is wrapped as an array and added to the result,
and a new current partition is created, initially containing the item <var>J</var> only. If the <code>$split-when</code>
function returns <code>false</code>, the item <var>J</var> is added to the current partition.</p>
function returns <code>false</code> or <code>()</code>, the item <var>J</var> is added to the current partition.</p>
<p>More formally, the function returns the result of the expression:</p>
<eg>fold-left($input, (), fn($partitions, $next, $pos) {
if (empty($partitions) or $split-when(foot($partitions)?*, $next, $pos))
Expand Down

0 comments on commit 6e789a2

Please sign in to comment.