aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2025-07-31 11:10:08 +0100
committerGitHub <noreply@github.com>2025-07-31 11:10:08 +0100
commitf00759473f05ca8025607b56428f0c39a0cdcee5 (patch)
treebd46dfe16a04030707daa6f4da32660c6e8d17e3
parent91682ed33be660271e236b130ea12588426e986b (diff)
parent4e5926710fe034bebb86b092d1607a5ed783f5d2 (diff)
downloadperlweeklychallenge-club-f00759473f05ca8025607b56428f0c39a0cdcee5.tar.gz
perlweeklychallenge-club-f00759473f05ca8025607b56428f0c39a0cdcee5.tar.bz2
perlweeklychallenge-club-f00759473f05ca8025607b56428f0c39a0cdcee5.zip
Merge pull request #12411 from ash/ash-332
Week 332 solutions in Raku by @ash
-rw-r--r--challenge-332/ash/raku/ch-1.raku10
-rw-r--r--challenge-332/ash/raku/ch-2.raku10
2 files changed, 20 insertions, 0 deletions
diff --git a/challenge-332/ash/raku/ch-1.raku b/challenge-332/ash/raku/ch-1.raku
new file mode 100644
index 0000000000..ff938e8b2c
--- /dev/null
+++ b/challenge-332/ash/raku/ch-1.raku
@@ -0,0 +1,10 @@
+# Task 1 of the Weekly Challenge 332
+# https://theweeklychallenge.org/blog/perl-weekly-challenge-332/#TASK1
+
+say bin-date('2025-07-26'); # 11111101001-111-11010
+say bin-date('2000-02-02'); # 11111010000-10-10
+say bin-date('2024-12-31'); # 11111101000-1100-11111
+
+sub bin-date($date) {
+ return ($date.split('-').map: *.Int.base(2)).join('-');
+}
diff --git a/challenge-332/ash/raku/ch-2.raku b/challenge-332/ash/raku/ch-2.raku
new file mode 100644
index 0000000000..5ba0a04a01
--- /dev/null
+++ b/challenge-332/ash/raku/ch-2.raku
@@ -0,0 +1,10 @@
+# Task 2 of the Weekly Challenge 332
+# https://theweeklychallenge.org/blog/perl-weekly-challenge-332/#TASK2
+
+say are-all-letters-odd('weekly'); # False
+say are-all-letters-odd('perl'); # True
+say are-all-letters-odd('challenge'); # False
+
+sub are-all-letters-odd($str) {
+ return !($str.comb.Bag.first: *.value %% 2);
+}