aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2025-09-29 22:51:46 +0100
committerGitHub <noreply@github.com>2025-09-29 22:51:46 +0100
commit8f87ddf78380b206e77034a43b3a187506f41463 (patch)
tree1f73989d8d070b2102d82e531f3e16d685610f20
parent0712592627137bf53d2b18978df893099d2133a2 (diff)
parentf2ee938b9316749f68fef5800c19fb120214daa1 (diff)
downloadperlweeklychallenge-club-8f87ddf78380b206e77034a43b3a187506f41463.tar.gz
perlweeklychallenge-club-8f87ddf78380b206e77034a43b3a187506f41463.tar.bz2
perlweeklychallenge-club-8f87ddf78380b206e77034a43b3a187506f41463.zip
Merge pull request #12761 from rikedyp/master
week 341 in APL
-rw-r--r--challenge-341/richard-park/apl/BrokenKeyboard.aplf20
-rw-r--r--challenge-341/richard-park/apl/ReversePrefix.aplf17
2 files changed, 37 insertions, 0 deletions
diff --git a/challenge-341/richard-park/apl/BrokenKeyboard.aplf b/challenge-341/richard-park/apl/BrokenKeyboard.aplf
new file mode 100644
index 0000000000..28b3600b3b
--- /dev/null
+++ b/challenge-341/richard-park/apl/BrokenKeyboard.aplf
@@ -0,0 +1,20 @@
+ BrokenKeyboard←{
+⍝ ⍺: Scalar or vector of characters that cannot be types
+⍝ ⍵: Character scalar or vector of space-separated words
+⍝ ←: Count of words in ⍵ that can be typed in full
+
+ BK←{
+ ⍝ _←+/~∨/¨(' '=' ',⍵)⊂0,⍵∊⍥⎕C ⍺ ⍝ Nested version
+ +/~2<⌿0⍪(1⌽' '=' ',⍵)⌿+⍀0,⍵∊⍥⎕C ⍺
+ }
+
+⍝ Tests
+ 1≢'d'BK'Hello World':∘∘∘
+ 0≢'ae'BK'apple banana cherry':∘∘∘
+ 3≢''BK'Coding is fun':∘∘∘
+ 2≢'ab'BK'The Weekly Challenge':∘∘∘
+ 1≢'p'BK'Perl and Python':∘∘∘
+
+ 'All tests passed.'
+
+ }
diff --git a/challenge-341/richard-park/apl/ReversePrefix.aplf b/challenge-341/richard-park/apl/ReversePrefix.aplf
new file mode 100644
index 0000000000..7f69b7eb20
--- /dev/null
+++ b/challenge-341/richard-park/apl/ReversePrefix.aplf
@@ -0,0 +1,17 @@
+ ReversePrefix←{
+⍝ ⍺:
+
+ RP←{
+ ⌽@(⍳⍵⍳⍺)⊢⍵
+ }
+
+⍝ Tests
+ 'gorpramming'≢'g'RP'programming':∘∘∘
+ 'hello'≢'h'RP'hello':∘∘∘
+ 'hgfedcbaij'≢'h'RP'abcdefghij':∘∘∘
+ 'srevere'≢'s'RP'reverse':∘∘∘
+ 'repl'≢'r'RP'perl':∘∘∘
+
+ 'All tests passed.'
+
+ }