On Thu, 31 Oct 2002, Damian Conway wrote:
: Larry wrote:
:
: > That's almost a reduce. Pity you have to include a variable.
: > But since rvalues are illegal on the left side of an assignment, we
: > *could* go as far as to say that
: >
: > 0 [+=] @b; # sum
: > 1 [*=] @b; # product
: > '' [~=] @b; # cat
: >
: > dwim into reduce operators rather than being illegal.
:
: ETOOCLEVERBYHALF, IMHO. ;-)
That's why I said "*could*". But I couldn't not say it. :-)
: I'd much rather see these common reductions be predefined C<sum>,
: C<product>, and C<cat> methods of Array, and the more obscure
: and bizarre reductions be explicitly marked with a C<reduce>:
:
: my $countersequence = reduce {$^x-$^y}, @b
I agree.
Larry