aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-253/simon-proctor/raku/ch-1.raku18
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-253/simon-proctor/raku/ch-1.raku b/challenge-253/simon-proctor/raku/ch-1.raku
new file mode 100644
index 0000000000..5e7fe365b6
--- /dev/null
+++ b/challenge-253/simon-proctor/raku/ch-1.raku
@@ -0,0 +1,18 @@
+#!/usr/bin/env raku
+
+multi sub MAIN('test') {
+ use Test;
+ is split-up( words => ("one.two.three","four.five","six"),
+ separator => "." ), ("one","two","three","four","five","six");
+ is split-up( words =>('$perl$$', '$$raku$'),
+ separator => '$' ), ('perl','raku');
+ done-testing;
+}
+
+multi sub MAIN($separator, *@words) {
+ split-up(:@words, :$separator).join(',').say;
+}
+
+sub split-up( :@words, :$separator ) {
+ @words.map( { | $_.split($separator) } ).grep( * ne '' ).list;
+}