Message from discussion
The Sort Problem
Newsgroups: perl.perl6.language
Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.stanford.edu!nntp.perl.org
Return-Path: <fibon...@babylonia.flatirons.org>
Mailing-List: contact perl6-language-h...@perl.org; run by ezmlm
Delivered-To: mailing list perl6-langu...@perl.org
Received: (qmail 89739 invoked by uid 76); 16 Feb 2004 08:06:40 -0000
Received: from x1.develooper.com (HELO x1.develooper.com) (63.251.223.170) by onion.perl.org (qpsmtpd/0.26) with SMTP; Mon, 16 Feb 2004 00:06:40 -0800
Received: (qmail 25564 invoked by uid 225); 16 Feb 2004 08:06:37 -0000
Delivered-To: perl6-langu...@perl.org
Received: (qmail 25519 invoked by alias); 16 Feb 2004 08:06:16 -0000
Received: from [161.97.199.99] (HELO babylonia.flatirons.org) (161.97.199.99) by la.mx.develooper.com (qpsmtpd/0.27-dev) with ESMTP; Mon, 16 Feb 2004 00:06:16 -0800
Received: by babylonia.flatirons.org (Postfix, from userid 2003) id 855BB1A9; Mon, 16 Feb 2004 01:06:05 -0700 (MST)
Date: Mon, 16 Feb 2004 01:06:05 -0700
To: Uri Guttman <u...@stemsystems.com>
Cc: Damian Conway <dam...@conway.org>, Perl 6 Language <perl6-langu...@perl.org>
Subject: Re: The Sort Problem
Message-ID: <20040216080605.GB19724@babylonia.flatirons.org>
References: <20040213045714.42092.qmail@web40806.mail.yahoo.com> <20040213065259.GA5819@babylonia.flatirons.org> <402C8767.9060509@rodadams.net> <x765ebxtfk.fsf@mail.sysarch.com> <402FF9E1.90403@conway.org> <x7u11r7tzq.fsf@mail.sysarch.com> <403024BD.4090405@conway.org> <x78yj37i52.fsf@mail.sysarch.com> <20040216063058.GA13708@babylonia.flatirons.org> <x7ptcf5xu1.fsf@mail.sysarch.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <x7ptcf5xu1.fsf@mail.sysarch.com>
User-Agent: Mutt/1.5.4i-ja.1
X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on x1.develooper.com
X-Spam-Status: No, hits=-4.9 required=8.0 tests=BAYES_00 autolearn=ham version=2.63
X-SMTPD: qpsmtpd/0.26, http://develooper.com/code/qpsmtpd/
Approved: n...@nntp.perl.org
From: fibon...@babylonia.flatirons.org (Luke Palmer)
Uri Guttman writes:
> >>>>> "LP" == Luke Palmer <fibon...@babylonia.flatirons.org> writes:
>
> LP> Uri Guttman writes:
> >> because that would be the default comparison and the extracted key value
> >> would be stringified unless some other marker is used. most sorts are on
> >> strings so this would be a useful huffman and removal of a redundancy.
>
> LP> While I like where most of this is going, I beg to differ on this point.
> LP> I end up sorting numbers more often then strings, except when I'm
> LP> sorting the keys of a hash. I'm always annoyed in my one liners when I
> LP> have to write out:
>
> LP> sort { $a <=> $b } ...
>
> LP> And I'd be thrilled if it were as easy as:
>
> LP> sort { +$_ } ...
>
> oh, i don't want to see <=> anywhere in sort code. i don't mind + or int
> as markers for that. you seem to actually be agreeing with me that
> strings are the default key type and + is needed for a numeric sort. but
> do you do integer or float sorts? and as i said, i don't like the
> asymmetry of int vs +.
Usually integer. But specifying integer is usually an optimization
guideline, whereas there is a much greater semantic difference between
sorting strings and floats. C<int> deserves to be longer as just an
optimization guideline.
And yes, I agree that string should be default.
Luke