From a180c2af9230a1dd1c81637b33cabf01d760b3ae Mon Sep 17 00:00:00 2001 From: RikedyP Date: Tue, 9 Sep 2025 09:56:27 +0100 Subject: week 338 in APL --- challenge-338/richard-park/apl/HighestRow.aplf | 21 +++++++++++++++++++++ challenge-338/richard-park/apl/MaxDistance.aplf | 13 +++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 challenge-338/richard-park/apl/HighestRow.aplf create mode 100644 challenge-338/richard-park/apl/MaxDistance.aplf diff --git a/challenge-338/richard-park/apl/HighestRow.aplf b/challenge-338/richard-park/apl/HighestRow.aplf new file mode 100644 index 0000000000..61bc27d5da --- /dev/null +++ b/challenge-338/richard-park/apl/HighestRow.aplf @@ -0,0 +1,21 @@ + HighestRow←{ + HR←{ + ⌈/+/⍵ + } + +⍝ Tests + Assert←{⍺←'Assertion Failure' ⋄ 0∊⍵:⍺ ⎕SIGNAL 8 ⋄ shy←0} + Assert 16 ≡ HR[ 4 4 4 4 + 10 0 0 0 + 2 2 2 9]: + Assert 10 ≡ HR[1 5 + 7 3 + 3 5]: + Assert 6 ≡ HR[1 2 3 + 3 2 1]: + Assert 17 ≡ HR[2 8 7 + 7 1 3 + 1 9 5]: + 'All tests passed.' + + } diff --git a/challenge-338/richard-park/apl/MaxDistance.aplf b/challenge-338/richard-park/apl/MaxDistance.aplf new file mode 100644 index 0000000000..322db02b53 --- /dev/null +++ b/challenge-338/richard-park/apl/MaxDistance.aplf @@ -0,0 +1,13 @@ + MaxDistance←{ + MD←{ + ⌈/,|⍵∘.-⍺ + } +⍝ Tests + Assert←{⍺←'Assertion Failure' ⋄ 0∊⍵:⍺ ⎕SIGNAL 8 ⋄ shy←0} + Assert 6≡4 5 7 MD 9 1 3 4: + Assert 6≡2 3 5 4 MD 3 2 5 5 8 7: + Assert 9≡2 1 11 3 MD 2 5 10 2: + Assert 2≡1 2 3 MD 3 2 1: + Assert 5≡1 0 2 3 MD 5 0: + 'All tests passed.' + } -- cgit