π Junction operators |, &, and ^ in Perl 6

# π Junction operators |, &, and ^ in Raku

N. B. Perl 6 has been renamed to Raku. Click to read more.

|, &, and ^ create the so-called junctions (formerly known in Perl 6 as quantum superpositions). These objects can be used where a scalar is used but behave differently; unlike the scalars, the junctions have multiple values at the same moment in time.

The |, &, and ^ operators create, respectively, the junctions of the any, all, and one types.

```# The value of 4 is one of the listed options
say "ok" if 4 == 1|2|3|4|5;Β Β

# There is no 4 in the list
say "ok" if 4 != 1 & 2 & 3 & 5; Β

# 4 repeats twice, thus it is not unique
say "ok" unless 4 == 1 ^ 2 ^ 2 ^ 4 ^ 4 ^ 5;```

## One thought on “π Junction operators |, &, and ^ in Perl 6”

1. Bruce Van Allen says:

Thanks for this great series!

Is this comment correct?
# There is no 4 in the list
say “ok” if 4 != 1 & 2 & 3 & 5; # ok
Consider:
say “ok” if 4 != 1 & 2 & 3 & 4 & 5; # ok
say “ok” if 4 == 4 & 4 & 4; # ok
say “ok” if 4 == 4 & 4 & 4 & 3; # ()