A suggestion

Lex Spoon lex at cc.gatech.edu
Wed Mar 13 18:59:40 UTC 2002


"Richard A. O'Keefe" <ok at cs.otago.ac.nz> wrote:
> (what I need is lexicographic order, which this isn't, and
>  what a sortblock must provide is a total order over the elements in
>  the collection, which this doesn't)

Hmm, requiring a total ordering is a good excuse--I mean rationale!--for
using lexicographic order for #<.  If you just want a comparison
operation, and don't care what it's exact meaning is, then it's best if
we supply a total ordering.  This happens in practice -- you might want
to stick the items in a binary tree.


> If we are allowed to add arrays (and we are), why not compare them?
> And if we compare them, is lexicographic order the most suitable?
> (There are other orders which are also compatible with =, such as
>  - first compare the lengths,
>  - then compare the elements ONLY if the lengths are the same.
>  This is almost always faster, and has some nice properties.

Gee, yet another way to compare collections.  Note, though, that this is
not a total ordering, either -- arrays of different lengths will be ~=
but they will be neither #< nor #> .


-Lex



More information about the Squeak-dev mailing list