Sorting help!
Stefan Schmiedl
s at xss.de
Thu Nov 15 19:47:23 UTC 2001
Jon Hylands (2001-11-15 12:07):
> On Thu, 15 Nov 2001 19:37:13 +0100, Stefan Schmiedl <s at xss.de> wrote:
>
> > sorting the <title> field strings will work, even
> > if they have different lengths. Access to the <name>
> > field is only necessary if the <title> field of the
> > records in question is identical, hence has the same
> > length. So sorting the name field only occurs with
> > identical "prefixes", which have no effect on sort order.
>
> The only reason you can get away with that is because $, has an ascii value
> of less than alphabetic characters. If you used $| as the separater, it
> wouldn't work in some cases.
??? oh, because with higher-value separators the short words would come
after the long words. yes, you're right there.
>
> I wouldn't want to trust a sort algorithm like that in any application I
> cared about...
well, I assumed that the input was generated externally
and hence unlikely to change. so I did The Simplest Thing
That Could Possibly Work. :-)
if the external data format ever changes, well, that's another
User Story.
But let's not get into philosphical debates here, one GPL-discussion
thread per year is enough. :-)
s.
--
Stefan Schmiedl
EDV-Beratung, Programmierung, Schulung
Loreleystr. 5, 94315 Straubing, Germany
Tel. (0 94 21) 74 01 06
Public Key: http://xss.de/stefan.public
shhhh ... I can't hear my code!
More information about the Squeak-dev
mailing list
|