diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2024-01-28 03:19:33 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-28 03:19:33 +0000 |
| commit | 43216503433cbdb5a62328c7e63ce1d4ec807f0d (patch) | |
| tree | 1d5ad1f8a075adfe7a2352af5300ff159f76ba58 | |
| parent | 19fa087f7c4e5e98b0b53ac8617ebbb5e8163cda (diff) | |
| parent | 2e2f0b61de2d5b2426e8e34bddea8bb28a8b1447 (diff) | |
| download | perlweeklychallenge-club-43216503433cbdb5a62328c7e63ce1d4ec807f0d.tar.gz perlweeklychallenge-club-43216503433cbdb5a62328c7e63ce1d4ec807f0d.tar.bz2 perlweeklychallenge-club-43216503433cbdb5a62328c7e63ce1d4ec807f0d.zip | |
Merge pull request #9467 from andemark/challenge-253
ch-2.raku simplified
| -rw-r--r-- | challenge-253/mark-anderson/raku/ch-1.raku | 4 | ||||
| -rw-r--r-- | challenge-253/mark-anderson/raku/ch-2.raku | 44 |
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 } |
