25 points · by 7thaccount · 6y ago · 12 comments
I'm not familiar with APL, but I can imagine that the test process for "how well can this language be read aloud" would be to have someone read out a short program over the phone and measure how long it takes and how many bugs are introduced. I wonder how people would handle significant-whitespace languages over the phone, for example?
(Yes, I know hardly anyone ever does this)
There are a few HN discussions u/arcfide and several YouTube presentations at functional programming conferences. Neat stuff!
It is part thesis, part tutorial, and part textbook. Cool item. I honestly don't remember the page number, but it was definitely over 100.
Sustainable code should be easy to read out loud.
For instance what does
p⌿⍨
mean?“P first-axis reduce or replicate/compress (commuted)”
Because APL functions only have a left and a right argument, and evaluates right to left but does parens first, it often means wrapping things on the left into parens to get them evaluated first. Commute (⍨) tacked onto a function reverses it’s arguments so you can put them the other way round and remove the parens e.g. 8-3 is 5 and 8-⍨3 is 3-8 is minus 5.
p⌿⍨... says (...)⌿p
Exactly what ⌿p does depends on what the rest is - it’s either a foldr operation if given a function, or “copy the items in p this many times each” if given a value or an array of values that matches the shape of p.
Looking at the link, it’s a replicate - that is, a filter. It filters p where the matching positions in t are =2, and t[p] is an array lookup (multiple indices at once) into another array.
I have no idea (yet?) how people say APL “reads left to right”, it seems to “decipher a bit at a time jumping all about from easy sections to hard sections”