Mastering Array Operations
Let’s first automate vector and other array creating because typing multidimensional structures on the interpreter’s command line, even if for testing purposes, is bothersome.
Generate Indexes and Index Arrays
The unary function ⍳N (literally the Greek letter iota) creates a vector of N consecutive integer numbers between 0 and N-1 or 1 and N. The function is called an index generator. The first element of the vector is determined by the index origin stored in the workspace indicator )ORIGIN (classical APL\360) or system variable ⎕IO (GNU APL; the box before IO is really a box, not a placeholder for a missing character). The variable can be only 0 or 1.
| | ⍳5 ⍝ The default value of ⎕IO is 1, courtesy of FORTRAN |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access