> Ummm...Maybe I'm missing something, but how does reduce() know the
   > difference between
   > 
   >         $sum = reduce ^_+^_, 0, @values;
   > 
   >         unshift @values, 0;
   >         $sum = reduce ^_+^_, @values;

There *isn't* any difference. Both versions guarantee that the list to be
reduced has at least one value, meaning the "no data" exception isn't an
issue.


   > Is this just a prototyping issue?

No. C<reduce>'s signature is:

        reduce ( \&reducer : uncurried, @data )
   

   > And if so, any reason not to make 0 the default value by default?

Yes. In the RFC you'll find several examples of reductions where the
default isn't 0. Simplest example:

        $product = reduce ^_*^_, 1, @data;


Damian

Reply via email to