YAP6 Operator: Junction Operators
by Adriano Ferreira
Another article of the series "Yet Another Perl 6 Operator"
Perl 6 introduces a new scalar data-type: the "junction". A junction is a single scalar value that can act like two or more values at once.
example a value which acts like
any(1,2,3) 1 or 2 or 3
all(@vals) all members of @vals at the same time
one(<moe curly larry>) one of the three stooges
none(@bad_guys) none of the listed bad guys
'^' are now junction constructors, providing a syntactical complement to the functional variants
$a | $b any($a, $b)
$x & $y all($x, $y)
$me ^ $you one($me, $you)