Index origin: Difference between revisions

Jump to navigation Jump to search
5 bytes removed ,  16:03, 30 March 2020
m
Iota -> Index Generator
m (15 revisions imported: Migrate from miraheze)
m (Iota -> Index Generator)
Line 1: Line 1:
{{Built-in|Index origin|⎕IO}} 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]] <source lang=apl inline>⎕IO</source>. Even array languages which do not have such a configuration parameter must make a choice of index origin; for example, [[A+]] and [[J]] use a non-configurable index origin of 0. The [[wikipedia:English language|English language]] uses an index origin of one: thus the element with index <source lang=apl inline>⎕IO</source> in APL is referred to in English as the "first" element.
{{Built-in|Index origin|⎕IO}} 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]] <source lang=apl inline>⎕IO</source>. Even array languages which do not have such a configuration parameter must make a choice of index origin; for example, [[A+]] and [[J]] use a non-configurable index origin of 0. The [[wikipedia:English language|English language]] uses an index origin of one: thus the element with index <source lang=apl inline>⎕IO</source> 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 <source lang=apl inline>⎕IO</source>.
The index origin affects both the handling of index arguments to functions (and other functionality like [[axis specification]]) and their results. For example, [[Index Generator]] creates results which begin with <source lang=apl inline>⎕IO</source>.
<source lang=apl>
<source lang=apl>
       ⎕IO←0
       ⎕IO←0
Line 22: Line 22:
! [[Monadic function]]s        !! [[Dyadic function]]s                          !! [[Operator]]s
! [[Monadic function]]s        !! [[Dyadic function]]s                          !! [[Operator]]s
|-
|-
| [[Iota]] (<source lang=apl inline>⍳</source>)     || [[Index-Of]] (<source lang=apl inline>⍳</source>)                || [[Key]] (<source lang=apl inline>⌸</source>) argument to <source lang=apl inline>⍺⍺</source>
| [[Index Generator]] (<source lang=apl inline>⍳</source>) || [[Index-Of]] (<source lang=apl inline>⍳</source>)                || [[Key]] (<source lang=apl inline>⌸</source>) argument to <source lang=apl inline>⍺⍺</source>
|-
|-
| [[Roll]] (<source lang=apl inline>?</source>)    || [[Deal]] (<source lang=apl inline>?</source>)                    || [[At]] (<source lang=apl inline>@</source>) result of <source lang=apl inline>⍵⍵</source>
| [[Roll]] (<source lang=apl inline>?</source>)    || [[Deal]] (<source lang=apl inline>?</source>)                    || [[At]] (<source lang=apl inline>@</source>) result of <source lang=apl inline>⍵⍵</source>

Navigation menu