First try:a skiplist implementation

Brian Rice water at tunes.org
Thu Jan 13 08:37:25 PST 2005


Okay. Thanks for the bug report - I'll have that fixed just now.

On Jan 13, 2005, at 8:22 AM, Márton Sasvári (IJ/ETH) wrote:

>
> 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
>
>
>
--
Brian T. Rice
LOGOS Research and Development
http://tunes.org/~water/




More information about the Slate mailing list