3 ms·
> At a time when adding two lists of numbers meant a map or a loop, APL introduced the idea of operating on the entire array at once. Am I missing something, h
by gbrown_ 7y ago
> At a time when adding two lists of numbers meant a map or a loop, APL introduced the idea of operating on the entire array at once.
Am I missing something, how is this different from a map?
- 7thaccount 7y agoAPL by default operates on entire arrays even if they're multi-dimensional like a matrix. You can just say matrix x 3 and it will automatically do the nested for-loops behind the scenes.
- gbrown_ 7y agoAha, thank you.
- icen 7y agoIt keeps going! 3 3 3 ⍴ ⍳10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 M ← 3 3 3 ⍴ ⍳10 M*M 1.00000E0 4.00000E0 2.70000E1 2.56000E2 3.12500E3 4.66560E4 8.23543E5 1.67772E7 3.87420E8 1.00000E10 1.00000E0 4.00000E0 2.70000E1 2.56000E2 3.12500E3 4.66560E4 8.23543E5 1.67772E7 3.87420E8 1.00000E10 1.00000E0 4.00000E0 2.70000E1 2.56000E2 3.12500E3 4.66560E4 8.23543E5 That's 3 nested 3x3 matrices, and we take the pointwise product of each of them with just the usual multiplication operator. How many maps did you want?
- RodgerTheGreat 7y agoIncidentally this property is why most of the "translations" of APL expressions into another language you'll see online are cheating- they assume a specific rank for arguments and "bake in" an appropriate degree of mapping.
- bonzini 7y agoIsn't that a pointwise exponentiation (1^1, 2^2, 3^3, ...)?
- jodrellblank 7y agoYes it is; APL uses × for multiplication.