aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Shitov <mail@andreyshitov.com>2025-09-22 08:52:35 +0200
committerAndrew Shitov <mail@andreyshitov.com>2025-09-22 08:52:35 +0200
commitf58c306998e73df7288f5bedbe7c84226b75631f (patch)
tree726657be06e22b018552dc86a668d202fdbebe81
parentc4e70544812c339e0344ad3127de18a5dbf98c34 (diff)
downloadperlweeklychallenge-club-f58c306998e73df7288f5bedbe7c84226b75631f.tar.gz
perlweeklychallenge-club-f58c306998e73df7288f5bedbe7c84226b75631f.tar.bz2
perlweeklychallenge-club-f58c306998e73df7288f5bedbe7c84226b75631f.zip
Week 340, Raku solutions by @ash
-rw-r--r--challenge-340/ash/raku/ch-1.raku13
-rw-r--r--challenge-340/ash/raku/ch-2.raku12
2 files changed, 25 insertions, 0 deletions
diff --git a/challenge-340/ash/raku/ch-1.raku b/challenge-340/ash/raku/ch-1.raku
new file mode 100644
index 0000000000..1bd8d01199
--- /dev/null
+++ b/challenge-340/ash/raku/ch-1.raku
@@ -0,0 +1,13 @@
+# Task 1 of the Weekly Challenge 340
+# https://theweeklychallenge.org/blog/perl-weekly-challenge-340/#TASK1
+
+say redup('abbaca'); # ca
+say redup('azxxzy'); # ay
+say redup('aaaaaaaa'); # ''
+say redup('aabccba'); # a
+say redup('abcddcba'); # ''
+
+sub redup($str is copy) {
+ while $str ~~ s:g/(.) $0// {};
+ return $str;
+}
diff --git a/challenge-340/ash/raku/ch-2.raku b/challenge-340/ash/raku/ch-2.raku
new file mode 100644
index 0000000000..caa4c3a5de
--- /dev/null
+++ b/challenge-340/ash/raku/ch-2.raku
@@ -0,0 +1,12 @@
+# Task 2 of the Weekly Challenge 340
+# https://theweeklychallenge.org/blog/perl-weekly-challenge-340/#TASK2
+
+say is-increasing('The cat has 3 kittens 7 toys 10 beds'); # True
+say is-increasing('Alice bought 5 apples 2 oranges 9 bananas'); # False
+say is-increasing('I ran 1 mile 2 days 3 weeks 4 months'); # True
+say is-increasing('Bob has 10 cars 10 bikes'); # False
+say is-increasing('Zero is 0 one is 1 two is 2'); # True
+
+sub is-increasing($str) {
+ [<] $str.comb(/\d+/)
+}