Operators

Junctions any / all / none

Full

Superpositions of values that test many possibilities at once and autothread.

A junction is several values held in one slot, combined by a logical mode: any (|), all (&), one (^), or none. Comparing against a junction tests all its members at once and collapses to a single Boolean.

any — does one match? #

The infix | builds an any junction; a comparison against it is true if any member matches.

say so 3 == (1 | 2 | 3);
say so 5 == (1 | 2 | 3);
Output
True
False

all and none #

all(…) is true when every member satisfies the test; none(…) when no member does.

say so all(2, 4, 6) %% 2;
say so 4 == none(1, 2, 3);
Output
True
True

Autothreading #

Using a junction anywhere else autothreads: the operation applies to each member and the result is a junction of the results.

say (1 | 2 | 3) + 1;
Output
any(2, 3, 4)

Notes #