At 11:52 PM -0700 2/12/04, Luke Palmer wrote:
But it needs some major syntax work so it can feel more like it's a part
of the language instead of a library function. Not, mind, that I think
Perl's syntax needs to be changed at all to accommodate.
Since everyone's well past mad here and deep into
Friday 13 February 2004 15:02, Dan Sugalski wrote:
If you're *really* looking to get fancy, why not just allow the
sort specification to be done with SQL? Comfortable,
well-understood, already has a decade or so of stupid things welded
into it [...]
Heck, you could even unify map, grep,
Here's my stab at a sort syntax, pulling syntax over from REs:
@out
== sort key:ri($_-[2]), key:s($_-[4])
== @in;
Basicly, you have a list of RE syntax like Ckey values, whilch take
various modifiers to say how to play with that key, and then an expr on
how to generate the key given element
Jonathan Lang writes:
We already have that. It's spelled:
routine [EMAIL PROTECTED];
Or
routine * == @x;
Then you've got your solution:
@sorted = sort {infix:= * map {$_.foo('bar').compute}, $^a, $^b }
@unsorted;
or
@sorted = sort {($^a, $^b)