help!!
sqrmax at cvtci.com.ar
sqrmax at cvtci.com.ar
Thu Apr 16 01:21:31 UTC 1998
Hi.
>How about: (in Set)
>hash
> ^self inject: 0 into: [:answer :each | answer bitXor: each hash]
Big set, slow hash. I would rather:
hash
^self size > 10
ifTrue: [self size]
ifFalse: [self inject: 0 into: [blablabla]]
And/or replace 10 by any other appropiate constant. I wonder what is the
distribution of the size of the sets?
sizes := Bag new
Set allInstances do: [:each | sizes add: each size]
sizes size 384
average := sizes inject: 0 into: [:total :each | total + each]
average := average / sizes size
average (315/128)
average asFloat 2.4609375
sizes occurrencesOf: 0 10
sizes occurrencesOf: 1 197
sizes occurrencesOf: 2 122
sizes occurrencesOf: 3 12
sizes occurrencesOf: 4 14
sizes occurrencesOf: 5 4
sizes occurrencesOf: 6 8
sizes occurrencesOf: 7 4
sizes occurrencesOf: 8 3
"Yes, I'm going to use my own selector!"
sizes asSet asSortedCollection SortedCollection (0 1 2 3 4 5 6 7 8 9 10 11
12 15 19 43 155 )
sizes occurrencesOf: 9 3
sizes occurrencesOf: 10 1
sizes occurrencesOf: 11 1
sizes occurrencesOf: 12 1
sizes occurrencesOf: 15 1
sizes occurrencesOf: 19 1
sizes occurrencesOf: 43 1
sizes occurrencesOf: 155 1
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.
More information about the Squeak-dev
mailing list
|