diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2020-12-18 22:45:20 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-18 22:45:20 +0000 |
| commit | ef326dd18baf3fbc823b184d453ae6f559c4c4cd (patch) | |
| tree | ca515b6778ac4b63347a2fc8a4e91baf5c4b255a | |
| parent | a395742fbe5e2605110c5fa4ee1f8a83e5c8173b (diff) | |
| parent | 616e651ea6eaf778ac620af3512b1540c0322c7d (diff) | |
| download | perlweeklychallenge-club-ef326dd18baf3fbc823b184d453ae6f559c4c4cd.tar.gz perlweeklychallenge-club-ef326dd18baf3fbc823b184d453ae6f559c4c4cd.tar.bz2 perlweeklychallenge-club-ef326dd18baf3fbc823b184d453ae6f559c4c4cd.zip | |
Merge pull request #3001 from stuart-little/stuart-little_034
1st commit on 034
| -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]); |
