Bugs item #1766173, was opened at 2007-08-02 16:07
Message generated for change (Comment added) made by boncz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1766173&group_id=56967

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: PF/compiler
Group: Pathfinder CVS Head
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Maurice van Keulen (mvankeulen)
Assigned to: Nobody/Anonymous (nobody)
Summary: Double for / position / subsequence bug

Initial Comment:
The query below contains a double for, each with an "at"-clause to track the 
position of the elements over which we iterate. We use subsequence to get the 
remainder of each list. The subsequence for the second list is incorrect.

declare function complete($al as xs:string*, $bl as xs:string*)
   as element(list)*
{
      for $a at $pa in $al
         ,$b at $pb in $bl
      let $arest := subsequence($al,$pa+1)
         ,$brest := subsequence($bl,$pb+1)
      return
         <list>
            <a pos="{$pa}">{$a}</a>
            <arest>{$arest}</arest>
            <b pos="{$pb}">{$b}</b>
            <brest>{$brest}</brest>
         </list>
};

<result>{
let $a := ("x","y")
   ,$b := ("p","q")
return
   complete($a,$b)
}</result>


it gives

<?xml version="1.0"?>
<result>
  <list>
    <a pos="1">x</a>
    <arest>y</arest>
    <b pos="1">p</b>
    <brest>p q</brest>
  </list>
  <list>
    <a pos="1">x</a>
    <arest>y</arest>
    <b pos="2">q</b>
    <brest>p q</brest>
  </list>
  <list>
    <a pos="2">y</a>
    <arest/>
    <b pos="1">p</b>
    <brest>p q</brest>
  </list>
  <list>
    <a pos="2">y</a>
    <arest/>
    <b pos="2">q</b>
    <brest>p q</brest>
  </list>
</result>


instead of

<?xml version="1.0"?>
<result>
  <list>
    <a pos="1">x</a>
    <arest>y</arest>
    <b pos="1">p</b>
    <brest>q</brest>
  </list>
  <list>
    <a pos="1">x</a>
    <arest>y</arest>
    <b pos="2">q</b>
    <brest/>
  </list>
  <list>
    <a pos="2">y</a>
    <arest/>
    <b pos="1">p</b>
    <brest>q</brest>
  </list>
  <list>
    <a pos="2">y</a>
    <arest/>
    <b pos="2">q</b>
    <brest/>
  </list>
</result>


----------------------------------------------------------------------

>Comment By: Peter Boncz (boncz)
Date: 2007-08-03 02:31

Message:
Logged In: YES 
user_id=591107
Originator: NO

fixed, really basic bug on computing pos inside function bodies (it only
worked for the first param)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=1766173&group_id=56967

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to