About MappedCollection

Avi Bryant avi at dabbledb.com
Fri May 25 08:06:35 UTC 2007


On 5/24/07, Chris Muller <asqueaker at gmail.com> wrote:
> I'll add, BTree's useful outside of OODB's too.

Yes, to be specific: it's useful any time you need a Dictionary-like
collection where the keys are Magnitudes (ie, implement #<=).

What you get: efficient sorted iteration through the keys, possibly
limited to a given range.  For example, if you store a list of people
keyed by their birthdate, and then want to find everyone born in a
certain year, in order of birth, you can do that very fast.

Also in the BTree package is a TSTree, which has similar properties
for String keys.  So as well as keeping them sorted, you can do
efficient lookups of all the keys with a given prefix.  One other neat
trick TSTree can do is a certain amount of fuzzy matching (eg find all
keys with an edit distance of 3 from 'foo') which makes it especially
useful for spell checking and similar applications.

Avi



More information about the Squeak-dev mailing list