help!!

Mike Klein mike at twinsun.com
Thu Apr 16 01:47:47 UTC 1998


> hash
> 	^self size > 10 
> 		ifTrue: [self size]
> 		ifFalse: [self inject: 0 into: [:answer :each | answer bitXor: 
each]]

I like better, thanks.  

> And/or replace 10 by any other appropiate constant. I wonder what is the 
> distribution of the size of the sets?

More important is the distribution of Sets that would be hashed.
I think 10 is a good number.

> Well, 10 turned out to be quite good... what I don't understand quite fine 
> is why are there so many sets with so few elements... about half of the 
> existing sets have only 1 object inside them. Most sets have either 1 or 2 
objects.
> 
> Andres.

Most of the Sets in the image are in the 'subclasses' instVar of classes
(only classes that actually have subclasses).  Hence, you are seeing the 
subclassing branch-factor effects, mostly.

Set allInstances size 171
(Metaclass allInstances reject: [:m| m soleInstance subclasses isEmpty]) size  
131

I.E.  out of 171 sets, 131  (about 3/4) are as I ascribed.





More information about the Squeak-dev mailing list