aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark <53903062+andemark@users.noreply.github.com>2024-01-28 03:02:31 +0000
committerMark <53903062+andemark@users.noreply.github.com>2024-01-28 03:02:31 +0000
commit2e2f0b61de2d5b2426e8e34bddea8bb28a8b1447 (patch)
treee0c7d42a6d828d5f34308a7d3b69222426f997ee
parent2c2d463c2eaea9d6bba26e3fcc4be2ad48a29c21 (diff)
downloadperlweeklychallenge-club-2e2f0b61de2d5b2426e8e34bddea8bb28a8b1447.tar.gz
perlweeklychallenge-club-2e2f0b61de2d5b2426e8e34bddea8bb28a8b1447.tar.bz2
perlweeklychallenge-club-2e2f0b61de2d5b2426e8e34bddea8bb28a8b1447.zip
ch-2.raku simplified
-rw-r--r--challenge-253/mark-anderson/raku/ch-1.raku4
-rw-r--r--challenge-253/mark-anderson/raku/ch-2.raku44
2 files changed, 22 insertions, 26 deletions
diff --git a/challenge-253/mark-anderson/raku/ch-1.raku b/challenge-253/mark-anderson/raku/ch-1.raku
index 0b4b73fcde..5741c3a12b 100644
--- a/challenge-253/mark-anderson/raku/ch-1.raku
+++ b/challenge-253/mark-anderson/raku/ch-1.raku
@@ -7,7 +7,7 @@ is-deeply split-strings(<one.two.three four.five six>, '.'),
is-deeply split-strings(<$perl$$ $$raku$>, '$'),
<perl raku>;
-sub split-strings(@a, $separator)
+sub split-strings(@words, $separator)
{
- flat @a>>.split($separator, :skip-empty)
+ flat @words>>.split($separator, :skip-empty)
}
diff --git a/challenge-253/mark-anderson/raku/ch-2.raku b/challenge-253/mark-anderson/raku/ch-2.raku
index 1a581b0901..6c98808ae5 100644
--- a/challenge-253/mark-anderson/raku/ch-2.raku
+++ b/challenge-253/mark-anderson/raku/ch-2.raku
@@ -1,33 +1,29 @@
#!/usr/bin/env raku
use Test;
-is-deeply weakest-rows([
- [1, 1, 0, 0, 0],
- [1, 1, 1, 1, 0],
- [1, 0, 0, 0, 0],
- [1, 1, 0, 0, 0],
- [1, 1, 1, 1, 1]
- ]),
- (2, 0, 3, 1, 4);
+is-deeply weakest-rows([ <1 1 0 0 0>,
+ <1 1 1 1 0>,
+ <1 0 0 0 0>,
+ <1 1 0 0 0>,
+ <1 1 1 1 1> ]), (2,0,3,1,4);
-is-deeply weakest-rows([
- [1, 0, 0, 0],
- [1, 1, 1, 1],
- [1, 0, 0, 0],
- [1, 0, 0, 0]
- ]),
- (0, 2, 3, 1);
+is-deeply weakest-rows([ <1 0 0 0>,
+ <1 1 1 1>,
+ <1 0 0 0>,
+ <1 0 0 0> ]), (0,2,3,1);
-is-deeply weakest-rows([
- [1, 1, 0, 0, 0],
- [1, 1, 1, 1, 0],
- [0, 0, 0, 0, 0],
- [1, 1, 0, 0, 0],
- [1, 1, 1, 1, 1]
- ]),
- (2, 0, 3, 1, 4);
+is-deeply weakest-rows([ <1 1 0 0 0>,
+ <0 0 0 0 0>,
+ <1 1 1 1 0>,
+ <0 0 0 0 0>,
+ <1 1 1 1 1>,
+ <0 0 0 0 0>,
+ <1 1 0 0 0>,
+ <1 1 1 1 1>,
+ <1 1 1 1 1>,
+ <1 0 0 0 0> ]), (1,3,5,9,0,6,2,4,7,8);
sub weakest-rows($m)
{
- $m.map({ .first(0, :k) // ∞ }).antipairs.sort>>.value
+ $m.antipairs.sort>>.value
}