diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2025-09-22 23:51:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-22 23:51:39 +0100 |
| commit | 4e428eb5aff8edd01f5d6ae245f6fb588253aac6 (patch) | |
| tree | f7d4abe7212fb96b924290b62bb1cb65e4843cb8 | |
| parent | 43f40042bcf3324ae95d19011acb5c6ecc79e608 (diff) | |
| parent | ffb20c09ebc3e739a4e6dad7ec7eb08f045ae1b9 (diff) | |
| download | perlweeklychallenge-club-4e428eb5aff8edd01f5d6ae245f6fb588253aac6.tar.gz perlweeklychallenge-club-4e428eb5aff8edd01f5d6ae245f6fb588253aac6.tar.bz2 perlweeklychallenge-club-4e428eb5aff8edd01f5d6ae245f6fb588253aac6.zip | |
Merge pull request #12722 from rikedyp/master
week 340 in APL
| -rw-r--r-- | challenge-340/richard-park/apl/AscendingNumbers.aplf | 15 | ||||
| -rw-r--r-- | challenge-340/richard-park/apl/DuplicateRemovals.aplf | 15 |
2 files changed, 30 insertions, 0 deletions
diff --git a/challenge-340/richard-park/apl/AscendingNumbers.aplf b/challenge-340/richard-park/apl/AscendingNumbers.aplf new file mode 100644 index 0000000000..cd34989af3 --- /dev/null +++ b/challenge-340/richard-park/apl/AscendingNumbers.aplf @@ -0,0 +1,15 @@ + AscendingNumbers←{ + + AN←{ + ∧/2</⊃(//⎕VFI)⍵ + } + +⍝ Tests + 1≢AN'The cat has 3 kittens 7 toys 10 beds':∘∘∘ + 0≢AN'Alice bought 5 apples 2 oranges 9 bananas':∘∘∘ + 1≢AN'I ran 1 mile 2 days 3 weeks 4 months':∘∘∘ + 0≢AN'Bob has 10 cars 10 bikes':∘∘∘ + 1≢AN'Zero is 0 one is 1 two is 2':∘∘∘ + + 'All tests passed.' + } diff --git a/challenge-340/richard-park/apl/DuplicateRemovals.aplf b/challenge-340/richard-park/apl/DuplicateRemovals.aplf new file mode 100644 index 0000000000..36a68192fe --- /dev/null +++ b/challenge-340/richard-park/apl/DuplicateRemovals.aplf @@ -0,0 +1,15 @@ + DuplicateRemovals←{ + DR←{ + 0∊⍴⍵:⍵ + ~∨/2=/⍵:,⍵ + ∇ ⍵⌿⍨~1(⊢∨⌽)0,2=/⍵ + } +⍝ Tests + 'ca'≢DR'abbaca':∘∘∘ + 'ay'≢DR'azxxzy':∘∘∘ + ''≢DR'aaaaaaaa':∘∘∘ + (,'a')≢DR'aabccba':∘∘∘ ⍝ Our function always returns a vector + ''≢DR'abcddcba':∘∘∘ + + 'All tests passed.' + } |
