Perl 6 Cool Perl 6 #60

Hyperoperators (vector processing)

We can also "promote" scalar values to act like arrays:

##  multiply all elements by 3.5
@b = @a »*» 3.5;

##  multiply all elements of @x by $m and add $b
@y = @x »*» $m »+» $b;

The orientation of the arrows indicate where extension is to occur.

##  inverse of @x
@inv = 1 «/« @x;
Copyright © 2010
http://www.pmichaud.com/2010/pres/