diff options
| -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 } |
