@John
Hello.
I started modifying your RB tree. I noticed that, while inserting two time
the same keys, the last inserted value replace
the previous one into your rbtree. As an illustration the following query
let $map := map:new( (map:entry("dummy","rocks"),map:entry("dummy","roll"))
)
return map:get($map,"dummy")
returns "roll"
I was expecting to "rocks". First : can you reproduce it ? (I modified your
files, and use BaseX interpretor. It is better to check with another
implementation).
Second, should I "roll" your rbtree or is this expected (is this a bug or
not ?) ?
2013/11/20 jean-marc Mercier <[email protected]>
> Yes you're right, using fold should be strightfroward.
>
> For the remove function, I'll try. Hopefully I won't spent too much time :)
> I'll keep you posted
>
>
> 2013/11/20 John Snelson <[email protected]>
>
>> On 20/11/13 13:16, jean-marc Mercier wrote:
>>
>>> ok. I've done a first draft that is working. I will keep the code a
>>> little bit to tune and complete it. For instance, that could be an idea
>>> to implement the remove($map,$key) function, or to implement key($map).
>>>
>>
>> Implenting keys($map) can be done using the fold() function. I recall the
>> remove() algorithm being a fair amount harder to implement in a functional
>> red/black tree, and I didn't need it so I didn't tackle it.
>>
>>
>> However, I have to modify your rbtree to do it.
>>>
>>
>> Very happy to accept contributions of a remove() implementation if you do
>> it. :-)
>>
>>
>> John
>>
>> --
>> John Snelson, Lead Engineer http://twitter.com/jpcs
>> MarkLogic Corporation http://www.marklogic.com
>>
>
>
_______________________________________________
[email protected]
http://x-query.com/mailman/listinfo/talk