aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark <53903062+andemark@users.noreply.github.com>2023-03-14 23:13:18 +0000
committerMark <53903062+andemark@users.noreply.github.com>2023-03-14 23:13:18 +0000
commit8e5c206909f60833316f94fd95e600e73850e983 (patch)
treeb5f944d795a4f2095bc19bc22978574ca9a7bc95
parent4eb4fceee746cca3ce78e163eb61961b42805adc (diff)
downloadperlweeklychallenge-club-8e5c206909f60833316f94fd95e600e73850e983.tar.gz
perlweeklychallenge-club-8e5c206909f60833316f94fd95e600e73850e983.tar.bz2
perlweeklychallenge-club-8e5c206909f60833316f94fd95e600e73850e983.zip
Challenge 208 Solutions (Raku)
-rw-r--r--challenge-208/mark-anderson/raku/ch-2.raku17
1 files changed, 1 insertions, 16 deletions
diff --git a/challenge-208/mark-anderson/raku/ch-2.raku b/challenge-208/mark-anderson/raku/ch-2.raku
index 36f56f72e2..fa193e2cd0 100644
--- a/challenge-208/mark-anderson/raku/ch-2.raku
+++ b/challenge-208/mark-anderson/raku/ch-2.raku
@@ -8,15 +8,7 @@ is-deeply duplicate-and-missing(4,5,6,7,7,8), (7,9);
is-deeply duplicate-and-missing(4,5,6,7,7,9), (7,8);
is-deeply duplicate-and-missing(4,5,6,6,7,9), (6,8);
is-deeply duplicate-and-missing(4,6,6,7,8,9), (6,5);
-
-use Algorithm::Diff;
-is-deeply diff-module(1,2,2,4), (2,3);
-is-deeply diff-module(1,2,3,4), -1;
-is-deeply diff-module(1,2,3,3), (3,4);
-is-deeply diff-module(4,5,6,7,7,8), (7,9);
-is-deeply diff-module(4,5,6,7,7,9), (7,8);
-is-deeply diff-module(4,5,6,6,7,9), (6,8);
-is-deeply diff-module(4,6,6,7,8,9), (6,5);
+is-deeply duplicate-and-missing(3,6,5,6,7,8), (6,4);
sub duplicate-and-missing(*@nums)
{
@@ -26,10 +18,3 @@ sub duplicate-and-missing(*@nums)
flat .repeated, keys @range (-) $_ or -1
}
}
-
-sub diff-module(*@nums)
-{
- my @range = .head .. .head + .end given @nums;
- my $r = diff(@nums, @range).comb(/\d+/)[1,3];
- $r.all.defined ?? $r>>.Int !! -1
-}