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

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