diff options
| author | RikedyP <rikedyp@gmail.com> | 2025-09-29 15:08:22 +0100 |
|---|---|---|
| committer | RikedyP <rikedyp@gmail.com> | 2025-09-29 15:08:22 +0100 |
| commit | f2ee938b9316749f68fef5800c19fb120214daa1 (patch) | |
| tree | 9b2cc16fe7c9808aebe9d66a485af57b346f82df | |
| parent | dd9dab4686fc230480c1ba07dc81492311c1d41f (diff) | |
| download | perlweeklychallenge-club-f2ee938b9316749f68fef5800c19fb120214daa1.tar.gz perlweeklychallenge-club-f2ee938b9316749f68fef5800c19fb120214daa1.tar.bz2 perlweeklychallenge-club-f2ee938b9316749f68fef5800c19fb120214daa1.zip | |
week 341 in APL
| -rw-r--r-- | challenge-341/richard-park/apl/BrokenKeyboard.aplf | 20 | ||||
| -rw-r--r-- | challenge-341/richard-park/apl/ReversePrefix.aplf | 17 |
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.' + + } |
