<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>26173</bug_id>
          
          <creation_ts>2014-06-22 16:47:36 +0000</creation_ts>
          <short_desc>[f+o 3.0] fold-left()/fold-right()</short_desc>
          <delta_ts>2014-09-10 14:37:05 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>Functions and Operators 3.0</component>
          <version>Working drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Kay">mike</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>108198</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-06-22 16:47:36 +0000</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111139</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-09-07 13:20:28 +0000</bug_when>
    <thetext>The relevant message can be found here

http://markmail.org/message/xqrtczzqa7dklj6x

See also the subsequent thread.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111144</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-09-07 14:39:02 +0000</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111345</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2014-09-10 14:37:05 +0000</bug_when>
    <thetext>For fold-left() we have a simple editorial problem:

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

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 &quot;accumulated value&quot; (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.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>