This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 26173 - [f+o 3.0] fold-left()/fold-right()
Summary: [f+o 3.0] fold-left()/fold-right()
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.0 (show other bugs)
Version: Working drafts
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-22 16:47 UTC by Michael Kay
Modified: 2014-09-10 14:37 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2014-06-22 16:47:36 UTC
From Dimitre Novachev on xsl-list today:


So, to summarize, Wolfgang and I found three issues in the
specification of the fold -xxx functions:

     1. The Error Conditions paragraph for fold-left conflicts with
the signature of the function.

     2. The Error Conditions paragraph for fold-right conflicts with
the signature of the function.

     3. The Rules section (code) for fold-right conflicts the
signature of the function.
Comment 1 Michael Kay 2014-09-07 13:20:28 UTC
The relevant message can be found here

http://markmail.org/message/xqrtczzqa7dklj6x

See also the subsequent thread.
Comment 2 Michael Kay 2014-09-07 14:39:02 UTC
Note also that in the equivalent XQuery function given for fold-left, there is a missing comma after the $seq argument in the function signature. Fixed in the 3.1 spec.
Comment 3 Michael Kay 2014-09-10 14:37:05 UTC
For fold-left() we have a simple editorial problem:

1. In the error description for fold-left(), change "and the second is $seq or any trailing subsequence of $seq." to "and the second is any single item from $seq".

For fold-right() we have a slightly deeper problem.

In the function signature proforma, we say that the supplied function has signature

$f as function(item()*, item()) as item()*

But then we say the effect of the function is equivalent to one in which $f is declared as 

$f as function(item(), item()*) as item()*

So the question is, which should we adopt? In the first case, the signature is assuming that the "accumulated value" (starting from $zero) comes first, and the item from the supplied $seq comes second. The other version assumes the opposite. The prose description of the error condition agrees with the second interpretation, as do the examples and test cases. So I think it is the function proforma we have to change: it becomes $f as function(item(), item()*) as item()*.

I have made these changes to the 3.1 specification and have noted them (in the changes.txt file) for any future 3.0 errata.