W3C home > Mailing lists > Public > public-qt-comments@w3.org > May 2016

[Bug 29626] New: fn:fold-left in appendix - calls not correct

From: <bugzilla@jessica.w3.org>
Date: Sun, 15 May 2016 18:02:10 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-29626-523@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=29626

            Bug ID: 29626
           Summary: fn:fold-left in appendix - calls not correct
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Functions and Operators 3.1
          Assignee: mike@saxonica.com
          Reporter: hrennau@yahoo.de
        QA Contact: public-qt-comments@w3.org
  Target Milestone: ---

In the appendix, examples use incorrect invocations of fn:fold-left - the order
of arguments is ($f, $zero, $seq) - whereas it should be ($seq, $zero, $f). 

This concerns the following examples (XSLT and XQuery):
* eg:distinct-nodes-stable
* eg:higheest
* eg:lowest


Example:

declare function eg:highest(
                     $f as function(item()) as xs:anyAtomicType, 
                     $seq as item()*)
                  as item()* {
     fn:fold-left(
       function($highestSoFar as item()*, $this as item()*) as item()* {
         let $thisValue := $f($this)
         let $highestValue := $f($highestSoFar[1])
         return
           if ($thisValue gt $highestValue)
             then $this
           else if ($thisValue eq $highestValue)
             then ($highestSoFar, $this)
           else $highestSoFar
       }, fn:head($seq), fn:tail($seq))
};

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Sunday, 15 May 2016 18:02:13 UTC

This archive was generated by hypermail 2.3.1 : Sunday, 15 May 2016 18:02:13 UTC