On Fri, Dec 12, 2008 at 11:49:37PM -0500, Uri Guttman wrote:
> 
>      @sorted = sort {(%M{$^a}//-M $^a) <=> (%M{$^b}//-M $^b)} @unsorted;
>      @sorted = map $_[1], sort {$^a[0] <=> $^b[0]}, map [-M,$_], @unsorted;
> 
> would both become:
> 
>      @sorted = sort {-M} @unsorted;

This prompted me to go review the file test operators so I could
say "here's how it would work in Rakudo", and guess what I found:

    The advantage of the method form is that it can be used in places that
    require tighter precedence than C<~~> provides:

        sort { $^a.M <=> $^b.M }, @files

    though that's a silly example since you could just write:

        sort { .M }, @files

So it looks like at least this part of the spec already documents
the feature, which means it _is_ in the spec after all -- just not
in S29 (which is where we were looking for it).

Pm

Reply via email to