[Bug 22302] New: The equivalent code for fn:for-each() is incorrect.

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

            Bug ID: 22302
           Summary: The equivalent code for fn:for-each() is incorrect.
    Classification: Unclassified
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Functions and Operators 3.0
          Assignee: mike@saxonica.com
          Reporter: nbrinza@gmail.com
        QA Contact: public-qt-comments@w3.org

In the current working draft of XQuery F&O 3.0, the fn:for-each() function (
http://www.w3.org/TR/xpath-functions-30/#func-for-each ) has the following
equivalent XQuery code:

declare function fn:for-each($seq, $f) {
  if (fn:empty($seq))
  then ()
  else $f(fn:head($seq)), fn:for-each(fn:tail($seq), $f)
};

Probably the parenthesis around the else branch have been omitted, and so this
code will result in an infinite recursion for any input. The fix would be to
change the line:

  else $f(fn:head($seq)), fn:for-each(fn:tail($seq), $f)

to: 

  else ($f(fn:head($seq)), fn:for-each(fn:tail($seq), $f))

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

Received on Thursday, 6 June 2013 18:20:14 UTC