Index origin: Difference between revisions
Jump to navigation
Jump to search
no edit summary
Miraheze>Marshall |
Miraheze>Adám Brudzewsky No edit summary |
||
Line 1: | Line 1: | ||
{{Primitive|⎕IO|Index origin}} is the number used for the first [[index]] along each [[axis]] of an array. Many APLs allow the user to configure index origin using the [[system variable]] <code>⎕IO</code>. Even array languages which do not have such a configuration parameter must make a choice of index origin; for example, [[J]] uses a non-configurable index origin of 0. The [https://en.wikipedia.org/wiki/English_language English language] uses an index origin of one: thus the element with index <code>⎕IO</code> in APL is referred to in English as the "first" element. | |||
The index origin affects both the handling of index arguments to functions (and other functionality like [[axis specification]]) and their results. For example, [[Iota]] (or "Index Generator") creates results which begin with <code>⎕IO</code>. | The index origin affects both the handling of index arguments to functions (and other functionality like [[axis specification]]) and their results. For example, [[Iota]] (or "Index Generator") creates results which begin with <code>⎕IO</code>. |