APL Demonstration (1975) [video]
youtube.com
youtube.com
blog←{⍺×⍵×1-⍵}
backbias←{+/,⍵}
logistic←{÷1+*-⍵}
maxpos←{(,⍵)⍳⌈/,⍵}
backavgpool←{2⌿2/⍵÷4}⍤2
meansqerr←{÷∘2+/,(⍺-⍵)*2}
avgpool←{÷∘4{+/,⍵}⌺(2 2⍴2)⍤2⊢⍵}
conv←{s←1+(⍴⍵)-⍴⍺⋄⊃+/,⍺×(⍳⍴⍺){s↑⍺↓⍵} ⊂⍵}
backin←{(d w in)←⍵⋄⊃+/,w{(⍴in)↑(-⍵+⍴d)↑⍺×d} ⍳⍴w}
multiconv←{(a ws bs)←⍵⋄bs{⍺+⍵ conv a}⍤(0,(⍴⍴a))⊢ws}
https://dl.acm.org/doi/pdf/10.1145/3315454.3329960It is pretty easy to write unmaintainable APL, it seems to me.
conv looks like the hardest. s←1+(⍴⍵)-⍴⍺ is the result shape, number of subarrays with the length of ⍺ that will fit in ⍵ in each dimension. Looks like (⍳⍴⍺){s↑⍺↓⍵}¨⊂⍵ is missing the ¨; the inner function s↑⍺↓⍵ drops ⍺ elements (left argument) and then takes the first s, so it gets a length-s window of ⍵. This is called on each possible index into ⍺, together with the whole of ⍵, so it ends up getting all such windows. Presumably s is expected to be larger than ⍴⍺ so this is the more efficient way to slice things. ⊃+/,⍺× multiplies by ⍺ and sums, ravelling with , before applying +/ to collapse the dimensions and sum them all at once. Each element is an array of shape s, so summing them gives a result of shape s. There you go, multidimensional convolution!
backbias←{+/,⍵}
logistic←{÷1+*-⍵}
maxpos←{(,⍵)⍳⌈/,⍵}
backavgpool←{2⌿2/⍵÷4}⍤2
meansqerr←{÷∘2+/,(⍺-⍵)*2}
avgpool←{÷∘4{+/,⍵}⌺(2 2⍴2)⍤2⊢⍵}
conv←{s←1+(⍴⍵)-⍴⍺⋄⊃+/,⍺×(⍳⍴⍺){s↑⍺↓⍵}¨⊂⍵}
backin←{(d w in)←⍵⋄⊃+/,w{(⍴in)↑(-⍵+⍴d)↑⍺×d}¨⍳⍴w}
multiconv←{(a ws bs)←⍵⋄bs{⍺+⍵ conv a}⍤(0,(⍴⍴a))⊢ws}https://www.youtube.com/live/gcUWTa16Jc0?si=Rld3IoiN7ijKnlWb
Just because it's not some C-derivative language doesn't mean there aren't those who can read and write it well.
Also, with APL, the code for something that can be expressed in linear algebra is reasonably natural, but when APL gets used to code other things it can be hard to reverse out what the author was thinking when they found a linear algebra expression of a problem for which that is not a natural mapping.
They meant regex.
What these all have in common is that the computer wasn't that clever (yet) compared to humans, so it was worth learning a cryptic but efficient (in terms of code size, or execution speed) language. Or maybe these "line noise" languages were just fashionable.
Now, JIT-ing something eminently readable is essentially free, so there is no more point in these old things (I don't personally use Matlab, but all the theory people at work do, and it seems to be the spiritual successor to APL).
APL just looks unfamiliar. Don't confuse that with unreadability. IMHO, the ergonomics for expressing and communicating high-level specifications just blows other languages out of the water. And those specifications also happen to also be executable implementations with leading-edge performance to boot.
Admittedly, though, the learning curve is painfully steep. I think it's worth it though.
APL Demonstration (1975) [video] - https://news.ycombinator.com/item?id=32118279 - July 2022 (1 comment)
APL Demonstration (1975) [video] - https://news.ycombinator.com/item?id=21104698 - Sept 2019 (51 comments)
APL Demonstration From 1975 [video] - https://news.ycombinator.com/item?id=7817593 - May 2014 (7 comments)
APL demonstration 1975 [video] - https://news.ycombinator.com/item?id=6155639 - Aug 2013 (1 comment
Direct link: https://www.youtube.com/watch?v=a9xAKttWgP4
https://www.youtube.com/@code_report
https://www.youtube.com/@arraycast