> >    > $a ^+= @list;  # should sum the elements of @list
   > 
   > Does this mean that 
   > 
   > @a ^+= @b;
   > 
   > will add every value of @b to every value of @a?

No. The rule is that a hyperoperator replicates its lower-dimensional
operand up to the same number of dimensions as its higher-dimensional
operand, then applies the hyped operator element-by-element across the
two operands.

Since @a and @b are (presumably) of the same dimensionality:

        @a ^+= @b;

means:

        @a[0] += @b[0]
        @a[1] += @b[2]
        @a[2] += @b[2]
        # etc.

To add every value of @b to every value of @a, you'll need either:

        @a ^+= reduce {$^a+$^b} @b;

or:

        @a = @(any(@a) + any(@y));

(depending on your definition of "every").

Damian

Reply via email to