Re: [FWP] sorting text in human-order

2001-01-08 Thread Jeff Okamoto
On Fri, Jan 05, 2001 at 09:42:12PM -0500, Brian Finney wrote: say we start with this number 123,456,789 one hundred twenty-three million four hundred fifty-six thousand seven hundred eighty-nine satakaksikymmentäkolme miljoonaa neljäsataaviisikymmentäkuusi tuhatta

Re: [FWP] sorting text in human-order

2001-01-08 Thread David Grove
I have an idea. Send that japanese to Larry and have him translate it. However he translates it, it's official. p Jeff Okamoto [EMAIL PROTECTED] wrote: On Fri, Jan 05, 2001 at 09:42:12PM -0500, Brian Finney wrote: say we start with this number 123,456,789 one hundred

Re: [FWP] sorting text in human-order

2001-01-06 Thread David Cantrell
On Fri, Jan 05, 2001 at 09:42:12PM -0500, Brian Finney wrote: generally speaking when you look a number and convert it into text you go through some simble steps say we start with this number 123,456,789 ... then we convert to words

Re: [FWP] sorting text in human-order

2001-01-05 Thread Bryan C. Warnock
On Fri, 05 Jan 2001, Piers Cawley wrote: But, but... 0.21 is *not* 'point twenty one', it's 'point two one', otherwise you get into weirdness with: .21 and .210 being spoken as 'point twenty one' and 'point two hundred (?:and)? ten' and all of a sudden the '2' in that figure has gained an

Re: [FWP] sorting text in human-order

2001-01-05 Thread John Porter
David Grove wrote: Ok, let's be pedantic. Everyone is pedantic. And they're all *right*. The one thing that I learned in high school speech class was that, if you say it, and people understand you, it's correct. It may not be proper, but it's correct, because it serves its purpose.

Re: [FWP] sorting text in human-order

2001-01-05 Thread David Grove
"Bryan C. Warnock" [EMAIL PROTECTED] wrote: On Fri, 05 Jan 2001, Piers Cawley wrote: But, but... 0.21 is *not* 'point twenty one', it's 'point two one', otherwise you get into weirdness with: .21 and .210 being spoken as 'point twenty one' and 'point two hundred (?:and)? ten' and all

Re: [FWP] sorting text in human-order

2001-01-05 Thread Brian Finney
generally speaking when you look a number and convert it into text you go through some simble steps say we start with this number 123,456,789 first we divide into sets of three (123,000,000)+(456,000)+(789) then we expand (123*1,000,000) + (456*1,000)+(789) and expand further

Re: [FWP] sorting text in human-order

2001-01-05 Thread Jarkko Hietaniemi
On Fri, Jan 05, 2001 at 09:42:12PM -0500, Brian Finney wrote: generally speaking when you look a number and convert it into text you go through some simble steps say we start with this number 123,456,789 first we divide into sets of three (123,000,000)+(456,000)+(789) then we expand

Re: [FWP] sorting text in human-order

2001-01-04 Thread Piers Cawley
Piers Cawley [EMAIL PROTECTED] writes: "David L. Nicol" [EMAIL PROTECTED] writes: Marc Lehmann wrote: On Sat, Dec 30, 2000 at 05:31:29AM +, "David L. Nicol" [EMAIL PROTECTED] wrote: I do not know exactly what the perl5 default sort heuristic is, aside that it tries to DWIM

Re: [FWP] sorting text in human-order

2001-01-04 Thread David Cantrell
On Thu, Jan 04, 2001 at 09:28:26AM +, Piers Cawley wrote: And for 'proper' library type sorting (assuming all works are in English) we should really be doing something like: require Lingua::EN::Numbers; s/(\d+(?:\.\d+))/Lingua::EN::Numbers-($1)-get_string/eg; since in a

Re: [FWP] sorting text in human-order

2001-01-04 Thread Piers Cawley
David Cantrell [EMAIL PROTECTED] writes: On Thu, Jan 04, 2001 at 09:28:26AM +, Piers Cawley wrote: And for 'proper' library type sorting (assuming all works are in English) we should really be doing something like: require Lingua::EN::Numbers;

Re: [FWP] sorting text in human-order

2001-01-03 Thread Piers Cawley
"David L. Nicol" [EMAIL PROTECTED] writes: Marc Lehmann wrote: On Sat, Dec 30, 2000 at 05:31:29AM +, "David L. Nicol" [EMAIL PROTECTED] wrote: I do not know exactly what the perl5 default sort heuristic is, aside that it tries to DWIM both numeric and string data. There is

Re: [Fwd: Re: [FWP] sorting text in human-order]

2001-01-02 Thread Jonathan Scott Duff
On Mon, Jan 01, 2001 at 04:31:42PM -0600, Jarkko Hietaniemi wrote: (1) Quicksort has a weak point where it goes deep into the Quadratic Land: (nearly) already ordered data. No, that is not so far-fetched a case. Mergesort has no similar weakpoints: its performance is in fact

Re: [Fwd: Re: [FWP] sorting text in human-order]

2001-01-02 Thread David L. Nicol
Jarkko Hietaniemi wrote: "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. Oh. $ perl -le

Re: [FWP] sorting text in human-order

2001-01-02 Thread David L. Nicol
Marc Lehmann wrote: On Sat, Dec 30, 2000 at 05:31:29AM +, "David L. Nicol" [EMAIL PROTECTED] wrote: I do not know exactly what the perl5 default sort heuristic is, aside that it tries to DWIM both numeric and string data. There is no heuristic, the default is simply $a cmp $b, so I

Re: [Fwd: Re: [FWP] sorting text in human-order]

2001-01-02 Thread Uri Guttman
"JSD" == Jonathan Scott Duff [EMAIL PROTECTED] writes: JSD On Mon, Jan 01, 2001 at 04:31:42PM -0600, Jarkko Hietaniemi wrote: (1) Quicksort has a weak point where it goes deep into the Quadratic Land: (nearly) already ordered data. No, that is not so far-fetched a case. Mergesort

Re: [Fwd: Re: [FWP] sorting text in human-order]

2001-01-01 Thread Jonathan Scott Duff
On Fri, Dec 29, 2000 at 11:47:59PM -0600, Jarkko Hietaniemi wrote: 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

Re: [Fwd: Re: [FWP] sorting text in human-order]

2001-01-01 Thread Jarkko Hietaniemi
On Mon, Jan 01, 2001 at 02:04:25PM -0600, Jonathan Scott Duff wrote: On Fri, Dec 29, 2000 at 11:47:59PM -0600, Jarkko Hietaniemi wrote: The sorting algorithm? Before 5.005 (I think...my memory is going) vendors' quicksort, after that Tom Horsley's excellent ultratuned quicksort (since

Re: [Fwd: Re: [FWP] sorting text in human-order]

2000-12-29 Thread Piers Cawley
"David L. Nicol" [EMAIL PROTECTED] writes: Piers Cawley [EMAIL PROTECTED] writes: [EMAIL PROTECTED] (Yitzchak Scott-Thoennes) writes: $srt =~ tr/0-9a-z\xe9/a-jA-ZE/; # uc sort nums after letters `10' is going to sort before `2' with that rule. Having done the whole bitter

Re: [Fwd: Re: [FWP] sorting text in human-order]

2000-12-29 Thread David L. Nicol
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

Re: [Fwd: Re: [FWP] sorting text in human-order]

2000-12-29 Thread Jarkko Hietaniemi
On Sat, Dec 30, 2000 at 05:31:29AM +, 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

Re: [Fwd: Re: [FWP] sorting text in human-order]

2000-12-28 Thread John Porter
Nathan Torkington wrote: By "pluggable" you mean that sort() should be overridable? use D::Oh s s\?s.s; -- John Porter What would Gabrielle do?

Re: [Fwd: Re: [FWP] sorting text in human-order]

2000-12-28 Thread Dan Sugalski
At 03:43 PM 12/28/00 -0500, John Porter wrote: Dan Sugalski wrote: use sort qw(radix_sort); sort \radix_sort @data; Isn't that the slot where the comparison function goes? Maybe something more like this: use sort::radix_sort; sort @data; # magically uses radix_sort instead of

Re: [Fwd: Re: [FWP] sorting text in human-order]

2000-12-28 Thread John Porter
Jarkko Hietaniemi wrote: If someone wants to play with such ideas there's Perl 5.7 which has a new mergesort as the incore sorting algorithm, while Perl 5.6 and before used quicksort. I'm triggering on the word "incore" there... I seem to recall someone suggested on perl6-language a while

Re: [Fwd: Re: [FWP] sorting text in human-order]

2000-12-28 Thread Jarkko Hietaniemi
On Wed, Dec 27, 2000 at 06:36:56PM -0600, David L. Nicol wrote: Is there a perl6 sort committee yet? AFter reading Cawley's method here, I wonder if using it we could make radix-sorts the default sort method. Radix sorts are great if the data cooperates, radix sorts can really fly in such

Re: [Fwd: Re: [FWP] sorting text in human-order]

2000-12-28 Thread Dan Sugalski
At 06:36 PM 12/27/00 -0600, David L. Nicol wrote: Is there a perl6 sort committee yet? AFter reading Cawley's method here, I wonder if using it we could make radix-sorts the default sort method. I don't see any reason to not allow this--perhaps a lexically scoped assignment to

Re: [Fwd: Re: [FWP] sorting text in human-order]

2000-12-28 Thread John Porter
Dan Sugalski wrote: use sort qw(radix_sort); sort \radix_sort @data; Isn't that the slot where the comparison function goes? Maybe something more like this: use sort::radix_sort; sort @data; # magically uses radix_sort instead of default. -- John Porter What would Gabrielle do?

Re: [Fwd: Re: [FWP] sorting text in human-order]

2000-12-28 Thread Jarkko Hietaniemi
On Thu, Dec 28, 2000 at 03:43:21PM -0500, John Porter wrote: Dan Sugalski wrote: use sort qw(radix_sort); sort \radix_sort @data; Isn't that the slot where the comparison function goes? Maybe something more like this: use sort::radix_sort; sort @data; # magically uses

Re: [Fwd: Re: [FWP] sorting text in human-order]

2000-12-28 Thread Peter Scott
At 04:34 PM 12/28/00 -0500, John Porter wrote: I seem to recall someone suggested on perl6-language a while back* (or was it perl6-internals?) that perl ought also to support efficient sorting of large volumes of data by using disk, the way unix sort does. Pluggable algorithms would make this

[Fwd: Re: [FWP] sorting text in human-order]

2000-12-27 Thread David L. Nicol
PROTECTED]) Received: from rt158.private.realtime.co.uk (IDENT:[EMAIL PROTECTED] [127.0.0.1])by rt158 (8.11.0/8.8.7) with ESMTP id eATExu511390;Wed, 29 Nov 2000 14:59:56 GMT From: Piers Cawley [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [FWP] sorting text in human-order References: [EMAIL

Re: [Fwd: Re: [FWP] sorting text in human-order]

2000-12-27 Thread John Porter
David L. Nicol wrote: Is there a perl6 sort committee yet? AFter reading Cawley's method here, I wonder if using it we could make radix-sorts the default sort method. Perl6 ought to support pluggable sort algorithms, just as Perl now supports pluggable comparison functions. -- John

Re: [Fwd: Re: [FWP] sorting text in human-order]

2000-12-27 Thread Nathan Torkington
John Porter writes: Perl6 ought to support pluggable sort algorithms, just as Perl now supports pluggable comparison functions. By "pluggable" you mean that sort() should be overridable? Nat