Raku By Example
View me onGitHub
# Autothreaded junctions

# 一般逻辑
{
my @valid = <foo bar baz>;
my $what = 'ber';
say "$what is not valid" if not @valid.grep: { $what eq $_ };
say "A ber or a bar"     if $what eq 'ber' or $what eq 'bar';
}

# 自动线程化的 junctions
my @valid = <foo bar baz>;
my $what = 'ber';
say "$what is not valid" if $what eq none @valid;
say "A ber or a bar"     if $what eq 'ber' | 'bar';


# any junction
my @bad_ext = ('plx', 'pm', 'pl', 'p6');
my $file_ext = 'p6';
if lc($file_ext) eq any(@bad_ext) {
    say "$file_ext files is  allowed, You are a Perler";
}


# regex and junction

my @endings = <a b c> ;
my $one-ending = @endings.join("|");
say $one-ending;

my $ending-rx = rx:i/ <$one-ending> $ /;
say $ending-rx;
say "acaba" ~~ $ending-rx;
say "acabó" ~~ $ending-rx;
say "cuac" ~~ $ending-rx;