Perl 6 Perl 6 today #31

Hyperoperators (vector processing)

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

##  multiple 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 © 2009
http://www.pmichaud.com/2009/pres/