routine so

Documentation for routine so assembled from the following types:

language documentation Operators

From Operators

(Operators) prefix so

multi sub prefix:<so>(Mu $x --> Bool:D)

Evaluates its argument in boolean context (and thus collapses Junctions), and returns the result.

class Mu

From Mu

(Mu) method so

method so()

Returns a Bool value representing the result of negating (with implicit conversion to Bool) the expression and then again computing the negation of the result, thus computing the Bool equivalent to the original expression.

One can use this method similarly to the English sentence: "If that is so, then do this thing". For instance,

my @args = <-a -e -b -v>;
my $verbose-selected = any(@argseq '-v' | '-V';
if $ {
    say "Verbose option detected in arguments";
} # OUTPUT: «Verbose option detected in arguments␤» 

The $verbose-selected variable in this case contains a Junction, whose value is any(any(False, False), any(False, False), any(False, False), any(True, False)). That is actually a truish value; thus, negating it will yield False. The negation of that result will be True. so is performing all those operations under the hood.

enum Bool

From Bool

(Bool) prefix so

multi sub prefix:<so>(Mu --> Bool:D)

Coerces its argument to Bool, has looser precedence than prefix:<?> .