--- title: "APL Competition 2022" author: "Jeremy Howard" date: "2022-07-05" categories: [Dyalog, APL, Glyphs] --- ]box on -style=max -trains=tree -fns=on 'Hip' 'Hop' ↑ 'Hip' 'Hop' ⍴↑ 'Hip' 'Hop' 'Hip' 'Hop' 'Dance' ↑ 'Hip' 'Hop' 'Dance' ⍴↑ 'Hip' 'Hop' 'Dance' (6 4) 5 3 ↑ (6 4) 5 3 (1 2) 3 (4 5 6) ↑(1 2) 3 (4 5 6) 4 ↑ 'Pineapple' 12 ↑ 'Pineapple' ¯5 ↑ 'Pineapple' ⎕←mat←3 4⍴⍳12 2 ↑ mat ¯2 ↑ mat 5 ↑ mat 2 ¯3 ↑ mat ⎕←mat←3 4⍴⍳12 ↓mat ⎕ ← mat ← 3 1⍴'Hip' 'Hop' 'Dance' ↓mat 4 ↓ 'Pineapple' 12 ↓ 'Pineapple' ¯5 ↓ 'Pineapple' ⎕←mat←3 4⍴⍳12 2 ↓ mat 2 ¯3 ↓ mat a ← 'banana' ,⌸ a a {⍺,+/⍵}⌸ ⍳6 a ,⌸ ⍳6 1 2 3 ⍴1 2 3 ⊂1 2 3 ⍴⊂1 2 3 1(2 3) ⍴ 1(2 3) 1,⊂2 3 ⊂ 1(2 3) ⍴⊂ 1(2 3) ⊂⊂ 1(2 3) ⊂1 1 2 3+⊂4 5 6 1 2 3+1 1 0 1 0 0 0 0⊂ 1 2 3 4 5 6 7 1 0 1 0 0 0 0⊂'HiEarth' 2 0 1 0 3 0 ⊂ 1 2 3 4 5 6 1 0 2 0 0 0 0⊂'HiEarth' (⊆1) ≡ ⊂1 (⊆1 2 3) ≡ ⊂1 2 3 (⊆ 1 (1 2 3)) ≡ 1 (1 2 3) ⊆ 1 (1 2 3) 1 (1 2 3) ⊂ 1 (1 2 3) 1 1 1 0 1 1 1 0 1 1 1 1⊆'How are you?' 1 1 2 2 2 2 2⊆'HiEarth' 1 1 2 2 2 0 0⊆'HiEarth' a←1 2 ⊂a a ≡ ⎕ ← ⊃⊂1 2 ⊃ 'Word' ⊃ (1 (1 2) 3) 4 ⊃ (1 2)(3 4 5) 3 ⊃ 'Word' 2 ⊃ (1 2)(3 4 5) 2 1 ⊃ (1 2)(3 4 5) ⎕←mat ← 2 3⍴⍳6 (⊂2 1) ⊃ 2 3⍴⍳6 G←2 3⍴('ABC' 1)('DEF' 2)('GHI' 3)('JKL' 4),('MNO' 5)('PQR' 6) G ((⊂2 1),1) ⊃ G ⊢1 ⊢'abc' 'abc'⊢1 1⊢'abc' ⊣'abc' 'abc'⊣1 1⊣'abc' 2 ⊥ 1 1 0 1 ⍝ binary decode ⍝ mixed radix: conversion of hours, ⍝ minutes and seconds to seconds: 24 60 60 ⊥ 2 46 40 (2×60×60) + (46×60) + 40 10 ⊥ 1 1 0 1 ⍝ decimal decode 10 ⊥ 3 4 1 6 ⍝ decimal decode 1j1⊥1 2 3 4 1⊥3 1 4 1 5 9 ⎕←M←3 4⍴⍳12 1⊥M 10 10 10 10 10 ⊤ 3658 ⍝ decimal encode 10 10 10 ⊤ 3658 ⍝ truncated decimal encode 0 10 10 ⊤ 3658 2 2 2 2 ⊤ 7 ⍝ binary encode 2 2 ⊤ 7 ⍝ truncated binary encode 2 2 2 2 ⊤ 5 7 12 ⍝ binary encode ⍝ mixed radix: encode of 10000 seconds ⍝ to hours, minutes and seconds: 24 60 60 ⊤ 10000 (÷3)+(*3) (÷+*)3 (+/÷≢) 2 5 8 9 mean ← +/÷≢ mean 2 5 8 9 ' '≠'How are you?' ' '⊢'How are you?' (' '≠'How are you?') ⊆ (' '⊢'How are you?') ' '(≠⊆⊢)'How are you?' split ← {(⍺≠⍵) ⊆ (⍺⊢⍵)} ' ' split 'How are you?'