34 ms·
Not sure I'd call APL an esolang - it's just an old language focused on array manipulation like you'd find in numpy
by bear8642 2y ago
Not sure I'd call APL an esolang - it's just an old language focused on array manipulation like you'd find in numpy
- llm_trw 2y agolife ← {⊃1 ⍵ ∨.∧ 3 4 = +/ +⌿ ¯1 0 1 ∘.⊖ ¯1 0 1 ⌽¨ ⊂⍵} https://aplwiki.com/wiki/John_Scholes%27_Conway%27s_Game_of_Life https://aplwiki.com/wiki/John_Scholes%27_Conway%27s_Game_of_... I'm not sure how you don't call that an eso lang.
- bear8642 2y agoWould you prefer something like this numpy then? def life(x): y = np.array([np.roll(x, -1), np.roll(x, 0),np.roll(x, 1)]) y = np.array([np.roll(y, -1, 1), np.roll(y, 0, 1),np.roll(y, 1, 1)]) z = y.sum(1).sum(0) a = np.array([3 == z, 4==z]) c = np.logical_and(np.array([np.ones(x.shape), x]), a) return np.logical_or(c[0], c[1]) Video of Scholes building up the life APL expression can be seen here: https://www.youtube.com/watch?v=a9xAKttWgP4 https://www.youtube.com/watch?v=a9xAKttWgP4