5 ms·
It says, unhelpfully, “P first-axis reduce or replicate/compress (commuted)” Because APL functions only have a left and a right argument, and evaluates right
by jodrellblank 7y ago
It says, unhelpfully,
“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”