Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/Extend-your-language/Raku/extend-your-language.raku
Normal file
21
Task/Extend-your-language/Raku/extend-your-language.raku
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
my &if2 = -> \a, \b, &x { my @*IF2 = ?a,?b; x }
|
||||
|
||||
my &if-both = -> &x { x if @*IF2 eq (True,True) }
|
||||
my &if-first = -> &x { x if @*IF2 eq (True,False) }
|
||||
my &if-second = -> &x { x if @*IF2 eq (False,True) }
|
||||
my &if-neither = -> &x { x if @*IF2 eq (False,False)}
|
||||
|
||||
sub test ($a,$b) {
|
||||
$_ = "G"; # Demo correct scoping of topic.
|
||||
my $got = "o"; # Demo correct scoping of lexicals.
|
||||
my $*got = "t"; # Demo correct scoping of dynamics.
|
||||
|
||||
if2 $a, $b, {
|
||||
if-both { say "$_$got$*got both" }
|
||||
if-first { say "$_$got$*got first" }
|
||||
if-second { say "$_$got$*got second" }
|
||||
if-neither { say "$_$got$*got neither" }
|
||||
}
|
||||
}
|
||||
|
||||
say test |$_ for 1,0 X 1,0;
|
||||
Loading…
Add table
Add a link
Reference in a new issue