From 7c38fac0a237e8cbb017fd8769627a0c9bdbd663 Mon Sep 17 00:00:00 2001 From: Scimon Date: Thu, 25 Jan 2024 14:42:43 +0000 Subject: Challenge 1 done --- challenge-253/simon-proctor/raku/ch-1.raku | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 challenge-253/simon-proctor/raku/ch-1.raku 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; +} -- cgit