Adam Turoff wrote:
> This message is not an RFC, nor is it an intent to add a feature 
> to Perl or specify a syntax for that feature[*].  

Yay.


> We're all for making easy things easy, but the complexities of
> "map {} sort {} map {} @list" has always been befuddling to newbies,
> especially when reading the code left-to-right.

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 );

???

I guess that would allow reordering the functions:

  @s = schwartzian(
    {
      first_map   => sub { [ $_, /num:(\d+)/ ] },
      the_sort    => sub { $a->[1] <=> $b->[1] },
      second_map  => sub { $_->[0] },
    },
    @t );

Is that really an improvement?

Every programmer understands right-to-left data flow when it's
written with parentheses.  Perl novices just need to understand
that

   map { & } sort { & } map { & } @

is a mere syntactic rewrite of

  map( &, sort( &, map( &, @ ) ) )


-- 
John Porter

Useless use of time in void context.

Reply via email to