On Tue, Mar 20, 2001 at 11:15:51PM -0500, John Porter wrote:
> So you think
> 
>   @s = 
>     map  { $_->[0] }
>     sort { $a->[1] <=> $b->[1] }
>     map  { [ $_, /num:(\d+)/ ] }
>       @t;
> 
> would be more clearly written as
> 
>   @s = schwartzian(
>     {
>       second_map  => sub { $_->[0] },
>       the_sort    => sub { $a->[1] <=> $b->[1] },
>       first_map   => sub { [ $_, /num:(\d+)/ ] },
>     },
>     @t );

Why can't Perl automagically do a Schwartzian when it sees a comparison with
complicated operators or functions on each side of it?
That is, @s = sort { f($a) <=> f($b) } @t would Do The Right Thing.

-- 
What happens if a big asteroid hits the Earth?  Judging from realistic
simulations involving a sledge hammer and a common laboratory frog, we
can assume it will be pretty bad. - Dave Barry

Reply via email to