Public bug reported:

I guess there's a problem with the optimizer.
Try the following code:


import module namespace map = 
"http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;

declare namespace ann = "http://www.zorba-xquery.com/annotations";;
declare variable $local:processed-internal-links := 
xs:QName("processed-internal-links");

declare %ann:sequential function local:f1($n as xs:string)
{
  map:insert($local:processed-internal-links, $n, $n);
  fn:trace($n, "n=");
  
  for $x in ("1", "2", "3")
  return
    if(fn:empty(map:get($local:processed-internal-links, $x))) then
      local:f1($x)
    else
      ()
};

map:create($local:processed-internal-links, xs:QName("xs:string"));

local:f1("0")

It should display 0 1 2 3
But it displays 0 1 2 3 3 2 3

** Affects: zorba
     Importance: Undecided
     Assignee: Markos Zaharioudakis (markos-za)
         Status: New

** Changed in: zorba
     Assignee: (unassigned) => Markos Zaharioudakis (markos-za)

-- 
You received this bug notification because you are a member of Zorba
Coders, which is the registrant for Zorba.
https://bugs.launchpad.net/bugs/872234

Title:
  problems with unordered map

Status in Zorba - The XQuery Processor:
  New

Bug description:
  I guess there's a problem with the optimizer.
  Try the following code:

  
  import module namespace map = 
"http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";;

  declare namespace ann = "http://www.zorba-xquery.com/annotations";;
  declare variable $local:processed-internal-links := 
xs:QName("processed-internal-links");

  declare %ann:sequential function local:f1($n as xs:string)
  {
    map:insert($local:processed-internal-links, $n, $n);
    fn:trace($n, "n=");
    
    for $x in ("1", "2", "3")
    return
      if(fn:empty(map:get($local:processed-internal-links, $x))) then
        local:f1($x)
      else
        ()
  };

  map:create($local:processed-internal-links, xs:QName("xs:string"));

  local:f1("0")

  It should display 0 1 2 3
  But it displays 0 1 2 3 3 2 3

To manage notifications about this bug go to:
https://bugs.launchpad.net/zorba/+bug/872234/+subscriptions

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to