aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-253/bruce-gray/raku/ch-1.raku11
-rw-r--r--challenge-253/bruce-gray/raku/ch-2.raku28
2 files changed, 39 insertions, 0 deletions
diff --git a/challenge-253/bruce-gray/raku/ch-1.raku b/challenge-253/bruce-gray/raku/ch-1.raku
new file mode 100644
index 0000000000..0fafe80d5d
--- /dev/null
+++ b/challenge-253/bruce-gray/raku/ch-1.raku
@@ -0,0 +1,11 @@
+sub task1 { @^words».split($^seperator, :skip-empty).flat }
+
+
+my @tests =
+ ( '.' , <one.two.three four.five six> , <one two three four five six> ),
+ ( '$' , <$perl$$ $$raku$> , <perl raku> ),
+;
+use Test; plan +@tests;
+for @tests -> ( $in_sep, @in_strings, @expected ) {
+ is-deeply task1( $in_sep, @in_strings ), @expected;
+}
diff --git a/challenge-253/bruce-gray/raku/ch-2.raku b/challenge-253/bruce-gray/raku/ch-2.raku
new file mode 100644
index 0000000000..5fd155003c
--- /dev/null
+++ b/challenge-253/bruce-gray/raku/ch-2.raku
@@ -0,0 +1,28 @@
+sub task2 { @^matrix.sort: :k, { +.grep(1) } }
+
+
+my @tests =
+ (
+ (
+ (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),
+ ),
+ (
+ (
+ (1, 0, 0, 0),
+ (1, 1, 1, 1),
+ (1, 0, 0, 0),
+ (1, 0, 0, 0),
+ ),
+ (0, 2, 3, 1),
+ ),
+;
+use Test; plan +@tests;
+for @tests -> ( @matrix, @expected ) {
+ is-deeply task2( @matrix ), @expected;
+}