Hi,

I have one bug:

The same function call: *functx:is-node-in-sequence-deep-equal(
$nodes[$seq],$nodes[position() < $seq])*

first used in [] => true?!
second used in if => false !

declare namespace functx = "http://www.functx.com";;
declare function functx:is-node-in-sequence-deep-equal
  ( $node as node()? , $seq as node()* )  as xs:boolean {
   some $nodeInSeq in $seq satisfies deep-equal($nodeInSeq,$node)
 } ;
declare function functx:distinct-deep
  ( $nodes as node()* )  as node()* {
    for $seq in (1 to count($nodes))
    *return $nodes[$seq][not(trace(functx:is-node-in-sequence-deep-equal(
$nodes[$seq],$nodes[position() < $seq]),'## '))]*
 } ;
let $in-xml :=
<authors>
   <author>
      <fName>Kate</fName>
      <lName>Jones</lName>
   </author>
   <author>
      <fName>Kate</fName>
      <lName>Jones</lName>
   </author>
   <author>
      <fName>Kate</fName>
      <lName>Doe</lName>
   </author>
</authors>
return functx:distinct-deep($in-xml//author)


SEDNA TRACE ##
*false*
<author>
 <fName>Kate</fName>
 <lName>Jones</lName>
</author>
SEDNA TRACE ##
*true*
SEDNA TRACE ##
*true*

declare namespace functx = "http://www.functx.com";;
declare function functx:is-node-in-sequence-deep-equal
  ( $node as node()? , $seq as node()* )  as xs:boolean {
   some $nodeInSeq in $seq satisfies deep-equal($nodeInSeq,$node)
 } ;
declare function functx:distinct-deep
  ( $nodes as node()* )  as node()* {
    for $seq in (1 to count($nodes))
    return* if 
(not(trace(functx:is-node-in-sequence-deep-equal($nodes[$seq],$nodes[position()
< $seq]),'## '))**)
    then ($nodes[$seq])
    else()*
 } ;
let $in-xml :=
<authors>
   <author>
      <fName>Kate</fName>
      <lName>Jones</lName>
   </author>
   <author>
      <fName>Kate</fName>
      <lName>Jones</lName>
   </author>
   <author>
      <fName>Kate</fName>
      <lName>Doe</lName>
   </author>
</authors>
return functx:distinct-deep($in-xml//author)


SEDNA TRACE ##
*false*
<author>
 <fName>Kate</fName>
 <lName>Jones</lName>
</author>
SEDNA TRACE ##
*true*
SEDNA TRACE ##
*false*

<author>
 <fName>Kate</fName>
 <lName>Doe</lName>
</author>

Why?

Thanks
Adrian
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sedna-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sedna-discussion

Reply via email to