aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-214/mark-anderson/raku/ch-2.raku27
1 files changed, 0 insertions, 27 deletions
diff --git a/challenge-214/mark-anderson/raku/ch-2.raku b/challenge-214/mark-anderson/raku/ch-2.raku
deleted file mode 100644
index fcc690a760..0000000000
--- a/challenge-214/mark-anderson/raku/ch-2.raku
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env raku
-use Adverb::Eject;
-use Test;
-
-is collect-points(2,4,3,3,3,4,5,4,2), 23;
-is collect-points(1,2,2,2,2,1), 20;
-is collect-points(1), 1;
-is collect-points(2,2,2,1,1,2,2,2), 40;
-is collect-points(9,1,1,1,35,35,44,1,5,5,2,5,2,5,44,85,7,7,7,85,1,1,1), 91;
-
-sub collect-points(*@a)
-{
- sum gather while @a
- {
- my $c = @a.pairs.classify({ .value }, :as{ .key });
- my $p = $c.first({ consecutive(.value) });
- my $a = $p ?? $p.value !! $c{ @a.Bag.minpairs.head.key };
-
- @a[ $a ]:eject;
- take $a.elems ** 2
- }
-}
-
-sub consecutive(@a)
-{
- .tail - .head == .end and [<] $_ given @a
-}