First try:a skiplist implementation

"Márton Sasvári (IJ/ETH)" Marton.Sasvari at ericsson.com
Thu Jan 13 08:22:24 PST 2005


Hi,

Brian Rice wrote:
<snip>
> 
> There's one issue that could expose a bug later, that you are using 
> RandomStream itself instead of calling newSeed: to get a fresh one. That 
> could cause contention in the presence of concurrency.
> 

That was something I did not understand in 'Set atRandomBy:'. Now it's 
clear why not 'RandomStream next' was used.

On the other hand I guess there is a typo in the mentioned method, 
namely 'ind:' seems to be 'index:'.

Currently it is:

c@(Set traits) atRandomBy: random
"Collaborate with a RandomStream to provide one of the elements at random."
[| index |
   c emptyCheck.
   ind: (random seed: c contents size).    "<- I do mean this line"
   index below: c contents size
	do: [| :i | (c contents at: i) ifNotNil: [^ c contents at: i]].
   0 below: index
     do: [| :i | (c contents at: i) ifNotNil: [^ c contents at: i]].
].

I know it would be more useful to send a diff but I'm in the learning of 
CVS yet.

> <snip>
> 
> Everything else looks pretty good, although I may spend some time 
> cleaning up the control-flow of the larger methods to make them a little 
> more clear before checking this into CVS (you don't mind, do you?).
> 

Thanks for the comments I will study the cleaned up CVS version.

Marton






More information about the Slate mailing list