[Bug 26476] New: Signature of array:fold-right and array:fold-left

https://www.w3.org/Bugs/Public/show_bug.cgi?id=26476

            Bug ID: 26476
           Summary: Signature of array:fold-right and array:fold-left
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Functions and Operators 3.1
          Assignee: mike@saxonica.com
          Reporter: arve.gengelbach@uni-konstanz.de
        QA Contact: public-qt-comments@w3.org

Hej,
just looking at the working draft on the array section. I know this is work in
progress. However I’d like to know how the signature of array:fold-right (and
left) is motivated.
Present signature is …

Section 17.3.13 array:fold-right
array:fold-right(
    $array     as array(*),
    $zero     as item()*,
    $function    as function(item()*) as item()*
) as array(*)


I’d expect an array:fold-right to be equivalent to the query:


declare function array:fold-right(
        $array     as array(*),
    $zero     as item()*,
        $function     as function(item()*, item()*) as item()*
) as item()* {
  if (array:size($seq) = 0)
  then $zero
  else $function(array:head($array), fn:fold-right(array:tail($array), $zero,
$function))
};

Hence the signature to be different to the one presently mentioned in the
draft. This signature then would be in analogy to fn:fold-right.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Wednesday, 30 July 2014 21:37:48 UTC