aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2025-06-16 21:37:34 +0100
committerGitHub <noreply@github.com>2025-06-16 21:37:34 +0100
commit8c3fcce6a4dbff79ea7c3d0ddf0a475245081d5c (patch)
treec8cbaf0cba9e5ec016b306ea0dc372b8829752ed
parent1f06b2260bb9fb23822ec953703b0565e48031b7 (diff)
parentb67241d960f87e37586f58a6fd6e7017c3ec4b9e (diff)
downloadperlweeklychallenge-club-8c3fcce6a4dbff79ea7c3d0ddf0a475245081d5c.tar.gz
perlweeklychallenge-club-8c3fcce6a4dbff79ea7c3d0ddf0a475245081d5c.tar.bz2
perlweeklychallenge-club-8c3fcce6a4dbff79ea7c3d0ddf0a475245081d5c.zip
Merge pull request #12188 from ash/ash-326
Solutions Week 326 in Raku by @ash
-rw-r--r--challenge-326/ash/raku/ch-1.raku6
-rw-r--r--challenge-326/ash/raku/ch-2.raku12
2 files changed, 18 insertions, 0 deletions
diff --git a/challenge-326/ash/raku/ch-1.raku b/challenge-326/ash/raku/ch-1.raku
new file mode 100644
index 0000000000..81ec31b2a9
--- /dev/null
+++ b/challenge-326/ash/raku/ch-1.raku
@@ -0,0 +1,6 @@
+# Solution to the Task 1 of the Weekly Challenge 326
+# https://theweeklychallenge.org/blog/perl-weekly-challenge-326/#TASK1
+
+say DateTime.new('2025-02-02').day-of-year; # 33
+say DateTime.new('2025-04-10').day-of-year; # 100
+say DateTime.new('2025-09-07').day-of-year; # 250
diff --git a/challenge-326/ash/raku/ch-2.raku b/challenge-326/ash/raku/ch-2.raku
new file mode 100644
index 0000000000..f471463392
--- /dev/null
+++ b/challenge-326/ash/raku/ch-2.raku
@@ -0,0 +1,12 @@
+# Solution to the Task 2 of the Weekly Challenge 326
+# https://theweeklychallenge.org/blog/perl-weekly-challenge-326/#TASK2
+
+say decompress(1, 3, 2, 4); # 3 4 4
+say decompress(1, 1, 2, 2); # 1 2 2
+say decompress(3, 1, 3, 2); # 1 1 1 2 2 2
+
+sub decompress(*@list) {
+ (gather for @list -> $repetitions, $value {
+ take $value xx $repetitions;
+ }).flat
+}