diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2025-09-22 23:44:45 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-22 23:44:45 +0100 |
| commit | ef8d29d67187f9e552bd9e4b1cbadde8107bc791 (patch) | |
| tree | 4a32055eb741aaff87e385722a89b62972285c39 | |
| parent | b2037e31794e9178a2a03f4692fc4817d306ce24 (diff) | |
| parent | f58c306998e73df7288f5bedbe7c84226b75631f (diff) | |
| download | perlweeklychallenge-club-ef8d29d67187f9e552bd9e4b1cbadde8107bc791.tar.gz perlweeklychallenge-club-ef8d29d67187f9e552bd9e4b1cbadde8107bc791.tar.bz2 perlweeklychallenge-club-ef8d29d67187f9e552bd9e4b1cbadde8107bc791.zip | |
Merge pull request #12711 from ash/ash-340
Week 340, Raku solutions by @ash
| -rw-r--r-- | challenge-340/ash/raku/ch-1.raku | 13 | ||||
| -rw-r--r-- | challenge-340/ash/raku/ch-2.raku | 12 |
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+/) +} |
