> "LP" == Luke Palmer <[EMAIL PROTECTED]> writes:
LP> Uri Guttman writes:
>> > "GNP" == Gregor N Purdy <[EMAIL PROTECTED]> writes:
>>
GNP> (But, the GRT doesn't apply to sorting general objects, and the
GNP> example has @unsorted containing objects on which we run
GNP> .foo('b
Uri Guttman writes:
> > "GNP" == Gregor N Purdy <[EMAIL PROTECTED]> writes:
>
> GNP> (But, the GRT doesn't apply to sorting general objects, and the
> GNP> example has @unsorted containing objects on which we run
> GNP> .foo('bar').compute.)
>
> there are no restrictions on what the GRT
> "GNP" == Gregor N Purdy <[EMAIL PROTECTED]> writes:
GNP> The Schwartzian is the usual way, of course:
GNP> map { $_->[1] }
GNP> sort { $^a[0] <=> $^b[0] }
GNP> map { [ $_.foo('bar').compute, $_ ] }
GNP> @unsorted;
and the GRT is another.
let stick my nose in here. sorti
- Original Message -
From: "Luke Palmer" <[EMAIL PROTECTED]>
To: "Language List" <[EMAIL PROTECTED]>
Sent: Wednesday, February 11, 2004 10:11 PM
Subject: [perl] The Sort Problem
> I've been thinking about this problem which comes up in my code a lot:
>
> @sorted = sort { $^a.foo('ba
Luke --
Hmmm... I haven't been practicing my Perl 6, and its been a while
since the last Apocalyptic refresher, but here goes (I'll don a paper
bag preemptively)...
Thinking of that as the equivalent to:
sort {
my ($ta, $tb) = map { $_.foo('bar').compute } ($^a, $^b);
$ta <=> $tb
} @
I've been thinking about this problem which comes up in my code a lot:
@sorted = sort { $^a.foo('bar').compute <=> $^b.foo('bar').compute }
@unsorted;
Often the expressions on each side are even longer than that. But one
thing remains: both sides are exactly the same, substi