diff options
| -rw-r--r-- | challenge-034/stuart-little/README | 1 | ||||
| -rwxr-xr-x | challenge-034/stuart-little/raku/ch-1.p6 | 15 | ||||
| -rwxr-xr-x | challenge-034/stuart-little/raku/ch-2.p6 | 13 |
3 files changed, 29 insertions, 0 deletions
diff --git a/challenge-034/stuart-little/README b/challenge-034/stuart-little/README new file mode 100644 index 0000000000..78439907de --- /dev/null +++ b/challenge-034/stuart-little/README @@ -0,0 +1 @@ +Solutions by Stuart Little diff --git a/challenge-034/stuart-little/raku/ch-1.p6 b/challenge-034/stuart-little/raku/ch-1.p6 new file mode 100755 index 0000000000..ce3698a028 --- /dev/null +++ b/challenge-034/stuart-little/raku/ch-1.p6 @@ -0,0 +1,15 @@ +#!/usr/bin/env perl6 +use v6; + +# run as <script> + +my %h=( + one => 1, + two => 2, + three => 3, + four => 4, +); + +say "A hash: ", %h.raku; +say "Slicing the hash to an array: ", %h.<one three>; +say "Slicing the hash to a slice: ", <one three>.map({ $_ => %h{$_} }).Hash.raku; diff --git a/challenge-034/stuart-little/raku/ch-2.p6 b/challenge-034/stuart-little/raku/ch-2.p6 new file mode 100755 index 0000000000..f8c141a163 --- /dev/null +++ b/challenge-034/stuart-little/raku/ch-2.p6 @@ -0,0 +1,13 @@ +#!/usr/bin/env perl6 +use v6; + +# run as <script> <binary Polish-notation operation, e.g. '+ 2 3' or '/ 5 6'; escape or quote '*' so it doesn't get captured by the shell> + +my %ops=( + '+' => &[+], + '-' => &[-], + '*' => &[*], + '/' => &[/], +); + +say %ops.{@*ARGS[0]}(|@*ARGS[1,2]); |
