YAP6 Operator: Reduce operators

by Adriano Ferreira

Another article of the series "Yet Another Perl 6 Operator"


And that's time to take a look at another of the Perl 6 meta-operators: the reduction operator.



By surrounding with square brackets an (associative) infix operator, a new list operator is created.



[*] 1..10      # that's 1*2*...*10 = 10!
[~] <m oo s e> # 'moose' - [~] is basically Perl 5 join
[,] 'a'..'e' # <a b c d e> - [,] is a list builder