Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

948 Reflected the comments of the CG on the specification of scan-left and scan-right #978

Merged
merged 5 commits into from
Feb 13, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions specifications/xpath-functions-40/src/function-catalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29489,7 +29489,7 @@ path with an explicit <code>file:</code> scheme.</p>
<fos:proto name="scan-left" return-type="array(*)*">
<fos:arg name="input" type="item()*" usage ="navigation"/>
<fos:arg name="zero" type="item()*"/>
<fos:arg name="action" type="function(item()*, item()*) as item()*" usage="inspection"/>
<fos:arg name="action" type="function(item()*, item()) as item()*" usage="inspection"/>
</fos:proto>
</fos:signatures>
<fos:properties>
Expand All @@ -29502,11 +29502,11 @@ path with an explicit <code>file:</code> scheme.</p>
the accumulator is assigned to during the evaluation of fn:fold-left.</p>
</fos:summary>
<fos:rules>
<p>The function is equivalent to the following implementation in XPath(return clause added for completeness):</p>
<p>The function is equivalent to the following implementation in XPath(return clause added in comments for completeness):</p>
<eg><![CDATA[
let $scan-left-inner := function($seq as item()*,
$zero as item()*,
$fun as function(item()*, item()*) as item()*,
$fun as function(item()*, item()) as item()*,
$self as function(*)
) as array(*)*
{
Expand All @@ -29521,14 +29521,15 @@ let $scan-left-inner := function($seq as item()*,

$scan-left := function($seq as item()*,
$zero as item()*,
$fun as function(item()*, item()*) as item()*
$fun as function(item()*, item()) as item()*
) as array(*)*
{
$scan-left-inner($seq, $zero, $fun, $scan-left-inner)
}

(:
return
$scan-left(1 to 10, 0, op('+'))
$scan-left(1 to 10, 0, op('+'))
:)
]]></eg>
</fos:rules>
<fos:errors>
Expand Down Expand Up @@ -29568,7 +29569,7 @@ $scan-left := function($seq as item()*,
without losing completely the intermediate results.</p>
<fos:test>
<fos:expression><eg>let $double := fn($x){2 * $x}
return $scan-left(1 to 5, (), fn($seq, $it){$seq , $double($it)})</eg></fos:expression>
return scan-left(1 to 5, (), fn($seq, $it){$seq , $double($it)})</eg></fos:expression>
<fos:result>[()], [2], [(2,4)], [(2,4,6)], [(2,4,6,8)], [(2,4,6,8,10)]</fos:result>
</fos:test>
</fos:example>
Expand Down Expand Up @@ -29603,11 +29604,11 @@ $scan-left := function($seq as item()*,
the accumulator is assigned to during the evaluation of fn:fold-right.</p>
</fos:summary>
<fos:rules>
<p>The function is equivalent to the following implementation in XPath(return clause added for completeness):</p>
<p>The function is equivalent to the following implementation in XPath(return clause in comments added for completeness):</p>
<eg><![CDATA[
let $scan-right-inner := function($seq as item()*,
$zero as item()*,
$f as function(item()*, item()*) as item()*,
$f as function(item()*, item()) as item()*,
$self as function(*)
) as array(*)*
{
Expand All @@ -29620,14 +29621,15 @@ let $scan-right-inner := function($seq as item()*,

$scan-right := function($seq as item()*,
$zero as item()*,
$f as function(item()*, item()*) as item()*
$f as function(item()*, item()) as item()*
) as array(*)*
{
$scan-right-inner($seq, $zero, $f, $scan-right-inner)
}

(:
return
$scan-right(1 to 10, 0, op('+'))
$scan-right(1 to 10, 0, op('+'))
:)
]]></eg>
</fos:rules>
<fos:errors>
Expand Down
Loading