Hyper- mega hyper and mega mega hyper!
You probably already know the so called Hyperoperators of Perl 6!
# This code
my @baz = @foo >>+<< @bar;
# Is the same as:
loop ($i = 0; $i < @bar.elems; ++$i) {
push @baz, @foo[$i] + @bar[$i];
}
A mega hyper operator takes you to the next level:
# This code
my @baz = @foo >>>>+<<<< @bar;
# Is the same as:
loop ($i = 0; $i < @bar.elems; ++$i) {
my $foo = @foo[$i];
my $bar = @bar[$i];
my $baz = @baz[$i];
loop ($j = 0; $j < $bar->elems; ++$j) {
push @$baz, $foo->[$j] + $bar->[$j];
}
}
And a mega mega hyper operator does this:
# This code
my @baz = @foo >>>>>>+<<<<<< @bar;
# Is the same as:
loop ($i = 0; $i <&t; @bar.elems; ++$i) {
my $foo = @foo[$i];
my $bar = @bar[$i];
my $baz = @baz[$i];
loop ($j = 0; $j < $bar->elems; ++$j) {
my $foo_ = $foo->[$j];
my $bar_ = $bar->[$j];
my $baz_ = $baz->[$j];
loop ($k = 0; $k < $bar_->elems; ++$k) {
push @$baz_, $foo_->[$k] + $bar_->[$k];
}
}
}
Etc... As you can see, its helping you to write less code!