aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsher Harvey-Smith <asherharveysmith@gmail.com>2024-03-19 15:29:45 +0000
committerAsher Harvey-Smith <asherharveysmith@gmail.com>2024-03-19 15:29:45 +0000
commitcb0cbac5ddd4fe8479bf6b30af9fa20cc605e33d (patch)
tree46b6ba44e8d296c19d0f14d69bc07fc5b03375d0
parente9c2946bf8e7d2b0e571a03ee44da5e4c6af3cdb (diff)
downloadperlweeklychallenge-club-cb0cbac5ddd4fe8479bf6b30af9fa20cc605e33d.tar.gz
perlweeklychallenge-club-cb0cbac5ddd4fe8479bf6b30af9fa20cc605e33d.tar.bz2
perlweeklychallenge-club-cb0cbac5ddd4fe8479bf6b30af9fa20cc605e33d.zip
apl solutions
-rw-r--r--challenge-261/asherbhs/ch-1.apl5
-rw-r--r--challenge-261/asherbhs/ch-2.apl4
-rw-r--r--challenge-261/asherbhs/ch-2.raku6
3 files changed, 12 insertions, 3 deletions
diff --git a/challenge-261/asherbhs/ch-1.apl b/challenge-261/asherbhs/ch-1.apl
new file mode 100644
index 0000000000..bc18b22284
--- /dev/null
+++ b/challenge-261/asherbhs/ch-1.apl
@@ -0,0 +1,5 @@
+ElementDigitSum←|⊢-⍥(+/)10(+/⊢⊤⍨(⌊1+⍟)⍴⊣)¨⊢
+ElementDigitSum 1 2 3 45
+ElementDigitSum 1 12 3
+ElementDigitSum 1 2 3 4
+ElementDigitSum 236 416 336 350
diff --git a/challenge-261/asherbhs/ch-2.apl b/challenge-261/asherbhs/ch-2.apl
new file mode 100644
index 0000000000..034ab436bd
--- /dev/null
+++ b/challenge-261/asherbhs/ch-2.apl
@@ -0,0 +1,4 @@
+MultiplyByTwo←{⍵∊⍺: ⍺∇2×⍵ ⋄ ⍵}
+5 3 6 1 12 MultiplyByTwo 3
+1 2 4 3 MultiplyByTwo 1
+5 6 7 MultiplyByTwo 2
diff --git a/challenge-261/asherbhs/ch-2.raku b/challenge-261/asherbhs/ch-2.raku
index 2a1edcf4e6..34d46b3688 100644
--- a/challenge-261/asherbhs/ch-2.raku
+++ b/challenge-261/asherbhs/ch-2.raku
@@ -4,6 +4,6 @@ sub multiply-by-two(Int @ints, Int $start --> Int) {
!! $start
}
-say multiply-by-two(Array[Int].new(5, 3, 6, 1, 12), 3);
-say multiply-by-two(Array[Int].new(1, 2, 4, 3), 1);
-say multiply-by-two(Array[Int].new(5, 6, 7), 2);
+say multiply-by-two Array[Int].new(5, 3, 6, 1, 12), 3;
+say multiply-by-two Array[Int].new(1, 2, 4, 3), 1;
+say multiply-by-two Array[Int].new(5, 6, 7), 2;