From b67241d960f87e37586f58a6fd6e7017c3ec4b9e Mon Sep 17 00:00:00 2001 From: Andrey Shitov Date: Mon, 16 Jun 2025 08:23:52 +0300 Subject: Solutions Week 326 in Raku by @ash --- challenge-326/ash/raku/ch-1.raku | 6 ++++++ challenge-326/ash/raku/ch-2.raku | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 challenge-326/ash/raku/ch-1.raku create mode 100644 challenge-326/ash/raku/ch-2.raku 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 +} -- cgit