aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Shitov <mail@andreyshitov.com>2025-08-11 07:45:07 +0200
committerAndrew Shitov <mail@andreyshitov.com>2025-08-11 07:45:07 +0200
commit0bc0829b888057541d312b238cbdd7dd61e691e9 (patch)
treef35a36f09ec04c1d0872d212795cd1072a812f9c
parent730e172acb159a2fc320a78a6250083328ef1067 (diff)
downloadperlweeklychallenge-club-0bc0829b888057541d312b238cbdd7dd61e691e9.tar.gz
perlweeklychallenge-club-0bc0829b888057541d312b238cbdd7dd61e691e9.tar.bz2
perlweeklychallenge-club-0bc0829b888057541d312b238cbdd7dd61e691e9.zip
Week 334, Task 1, solution in Raku by @ash
-rw-r--r--challenge-334/ash/raku/ch-1.raku12
1 files changed, 12 insertions, 0 deletions
diff --git a/challenge-334/ash/raku/ch-1.raku b/challenge-334/ash/raku/ch-1.raku
new file mode 100644
index 0000000000..c61a1ae2c1
--- /dev/null
+++ b/challenge-334/ash/raku/ch-1.raku
@@ -0,0 +1,12 @@
+# Task 1 of the Weekly Challenge 334
+# https://theweeklychallenge.org/blog/perl-weekly-challenge-334/#TASK1
+
+say solve([-2, 0, 3, -5, 2, -1], 0, 2); # 1
+say solve([1, -2, 3, -4, 5], 1, 3); # -3
+say solve([1, 0, 2, -1, 3], 3, 4); # 2
+say solve([-5, 4, -3, 2, -1, 0], 0, 3); # -2
+say solve([-1, 0, 2, -3, -2, 1], 0, 2); # 1
+
+sub solve(@data, $beg, $end) {
+ [+] @data[$beg..$end]
+}