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

2000-12-27 Thread David L. Nicol


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.




 Original Message 
Return-Path: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
Received: (qmail 10490 invoked from network); 29 Nov 2000 15:17:02 -
Received: from cpe-024-221-169-054.ca.sprintbbd.net (HELO cfcl.com) (24.221.169.54)by 
hilbert.umkc.edu with SMTP; 29 Nov
2000 15:17:02 -
Received: (from majordom@localhost)by cfcl.com (8.9.3/8.9.3) id HAA12020;Wed, 29 Nov 
2000 07:05:10 -0800
(PST)(envelope-from [EMAIL PROTECTED])
X-Authentication-Warning: cfcl.com: majordom set sender to [EMAIL PROTECTED] 
using -f
Received: from rt158 (firewall.realtime.co.uk [194.205.218.14])by cfcl.com 
(8.9.3/8.9.3) with ESMTP id HAA12015for
[EMAIL PROTECTED]; Wed, 29 Nov 2000 07:05:04 -0800 (PST)(envelope-from 
[EMAIL 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 PROTECTED]
Date: 29 Nov 2000 14:59:56 +
In-Reply-To: [EMAIL PROTECTED]'s message of "Tue, 28 Nov 2000 23:20:28 -0800"
Message-ID: [EMAIL PROTECTED]
Lines: 17
User-Agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (GTK)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Sender: [EMAIL PROTECTED]
Precedence: bulk
Reply-To: Piers Cawley [EMAIL PROTECTED]
X-Mozilla-Status: 9011
X-Mozilla-Status2: 
X-UIDL: 975511023.10493.hilbert.umkc.edu

[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 experience thing with this, may I suggest:

$srt =~ s/(\d+)/unpack("B32", pack("N",$1))/eg

Which will give you nice 32 bit binary representations of your
numbers, which have leading zeros and will sort properly via cmp. 

If you want a sample of the pain I had working that out, you should've
been at my 12 step perl session at YAPC::Europe.

-- 
Piers


 Want to unsubscribe from Fun With Perl?  Well, if you insist...
 Send email to [EMAIL PROTECTED] with message _body_
   unsubscribe




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 Porter

What would Gabrielle do?




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