diff options
| author | chirvasitua <stuart-little@users.noreply.github.com> | 2021-01-25 07:32:22 -0500 |
|---|---|---|
| committer | chirvasitua <stuart-little@users.noreply.github.com> | 2021-01-25 07:32:22 -0500 |
| commit | 1c7e21c38d6198dcff370c065ea0335d093aad2a (patch) | |
| tree | e172dc7c42f11a82051f482dbd25c5cbade48828 | |
| parent | c2e3d94308259dfeed2f131426c365adb88a9663 (diff) | |
| download | perlweeklychallenge-club-1c7e21c38d6198dcff370c065ea0335d093aad2a.tar.gz perlweeklychallenge-club-1c7e21c38d6198dcff370c065ea0335d093aad2a.tar.bz2 perlweeklychallenge-club-1c7e21c38d6198dcff370c065ea0335d093aad2a.zip | |
1st commit on 097_raku
| -rwxr-xr-x | challenge-097/stuart-little/raku/ch-1.p6 | 7 | ||||
| -rwxr-xr-x | challenge-097/stuart-little/raku/ch-2.p6 | 13 |
2 files changed, 20 insertions, 0 deletions
diff --git a/challenge-097/stuart-little/raku/ch-1.p6 b/challenge-097/stuart-little/raku/ch-1.p6 new file mode 100755 index 0000000000..d0be59447b --- /dev/null +++ b/challenge-097/stuart-little/raku/ch-1.p6 @@ -0,0 +1,7 @@ +#!/usr/bin/env perl6 +use v6; + +# run <script> <quoted string> <number> + +say @*ARGS[0].trans(['A'..'Z'] => ['A'..'Z'].rotate(26-@*ARGS[1].Int)) + diff --git a/challenge-097/stuart-little/raku/ch-2.p6 b/challenge-097/stuart-little/raku/ch-2.p6 new file mode 100755 index 0000000000..06038a1f63 --- /dev/null +++ b/challenge-097/stuart-little/raku/ch-2.p6 @@ -0,0 +1,13 @@ +#!/usr/bin/env perl6 +use v6; + +# run <script> <binary string> <integer> + +sub res(@strs) { zip(@strs).map(-> @s {@s.classify({$_}).max(*.value.elems).value.head}) } + +sub toflip(@target,@strs) { @strs.map(-> @s {(@s Z!== @target).grep({$_}).elems}).sum } + +my @strs = @*ARGS[0].comb.rotor(@*ARGS[1].Int); +my @target = res(@strs.List); + +say qq|Flip a total number of {toflip(@target,@strs)} positions to get {@target.join} from\n{@strs.map(*.join).join("\n")}| |
