On Sat, Dec 30, 2000 at 05:31:29AM +0000, David L. Nicol wrote:
> Piers Cawley wrote:
> >
> > >"David L. Nicol" <[EMAIL PROTECTED]> writes:
> > > After reading Cawley's
> > > method, I wondered if using it we could make radix-sorts the
> > > default sort method.
> >
> > Er... the point behind changing numbers to binary strings was
> > emphatically not so that they could be sorted by a Radix method, but
> > to ensure that numbers within text would sort correctly: qw(A1 A2 A3
> > A10) instead of qw(A1 A10 A2 A3)...
>
> The rsort documentation informs that radix-sorts will sort ascii
> text.
>
> My thought was that the perl6 default sort could do an implied ST on
> the data, using Cawley's Substitution, and then a radix-sort, instead
> of analyzing each pair of data to see if they are numeric or not using
> whatever the current heuristic is.
>
> I do not know exactly what the perl5 default sort heuristic is, aside that
> it tries to DWIM both numeric and string data.
"sort heuristic"? "DWIM both numeric and string data"? There is
no "heuristic". There is no "DWIM". Perl's sort() does by default
string sort based on the byte values of the strings of its argument
list. That's it. Period. Full stop.
If you want something else, like a numeric comparison, or, say, a
case-ignorant string comparison, or whatever, then you supply the
comparison function yourself.
The sorting algorithm? Before 5.005 (I think...my memory is going)
vendors' quicksort, after that Tom Horsley's excellent ultratuned
quicksort (since vendors' quicksorts were (a) buggy (c) slow),
in 5.7 mergesort by John Lindermann was introduced.
--
$jhi++; # http://www.iki.fi/jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen