[Q]uestions regarding collections
Jon Hylands
jon at huv.com
Sun Aug 19 04:14:30 UTC 2001
On Sat, 18 Aug 2001 20:49:07 -0500, Aaron <reic0024 at d.umn.edu> wrote:
> It would be irrelevant if the collection was ascending or descending.
> You can just use sortBlock value: x value: y. If true, go one way, if
> false go to another. You don't need to know anything about what the
> objects respond to (I've use sortBlocks like [:a :b| a x > b x] and [:a
> :b|a date < b date]), because the sortBlock can tell you.
Yeah, I'm looking at #indexForInserting: which does exactly that kind of
binary search.
Its funny, I don't think any of the major Smalltalk implementations use a
binary search for #includes: in SortedCollection, yet they all implement
one for adding new objects...
Later,
Jon
--------------------------------------------------------------
Jon Hylands Jon at huv.com http://www.huv.com/jon
Project: Micro Seeker (Micro Autonomous Underwater Vehicle)
http://www.huv.com
More information about the Squeak-dev
mailing list
|