diff options
| -rw-r--r-- | challenge-208/mark-anderson/raku/ch-2.raku | 17 |
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 -} |
