Hi Christian

You are right, the behavior from the link http://docs.basex.org/wiki/Map_Module#map:new is pretty clear.

Two remarks :

- might this mechanism not be a little bit misleading ? Indeed, I was expecting somehow that map:key(map:new({<node>:""})) to be an identity for <node>. Moreover, maps using elements as keys are of great interest. Could it be a suggestion to provide an optional binding to the key / value mechanism to tune the behavior of the map module ?

- A remark of minor importance : if distinct-values() is used to select keys, the map:module shouldn't accept sequences as keys ? If I try a map:new({("dummy","dummy"):""}), I am actually raising a XPTY0004 error.



2013/11/18 Christian Grün <christian.gruen@gmail.com>
Hi Jean-Marc,

> The following query
> map:size(map:new(({<dummy>dummy</dummy>:""},{<doudou>dummy</doudou>:""})))
> returns ..1.
>
> Does it means that the map module uses the function fn:data() to compute
> keys for nodes ??

Pretty much like that: The rules of the distinct-values() function are
used to decide if two keys are equal. See [1] for more details.

Christian

[1] http://docs.basex.org/wiki/Map_Module#map:new



>
> Cheers
>
> Jean-Marc
>
> _______________________________________________
> BaseX-Talk mailing list
> BaseX-Talk@mailman.uni-konstanz.de
> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
>