Indices: Difference between revisions
Jump to navigation
Jump to search
→Examples
Miraheze>Adám Brudzewsky No edit summary |
Miraheze>Adám Brudzewsky |
||
Line 8: | Line 8: | ||
In all implementations, Indices gives the indices of ones in a boolean [[vector]]. | In all implementations, Indices gives the indices of ones in a boolean [[vector]]. | ||
<source | <source lang=apl> | ||
⍸ 0 0 1 0 0 0 1 0 | ⍸ 0 0 1 0 0 0 1 0 | ||
3 7 | 3 7 | ||
Line 15: | Line 15: | ||
In [[Nested array model|nested]] APLs it returns nested indices when passed a [[matrix]] or higher-dimensional array. | In [[Nested array model|nested]] APLs it returns nested indices when passed a [[matrix]] or higher-dimensional array. | ||
<source | <source lang=apl> | ||
⍸ 3 3⍴0 0 1 0 0 0 1 0 | ⍸ 3 3⍴0 0 1 0 0 0 1 0 | ||
┌───┬───┐ | ┌───┬───┐ | ||
Line 28: | Line 28: | ||
If numbers higher than 1 are allowed, they indicate that the index of the number is repeated. Negative numbers are never allowed. | If numbers higher than 1 are allowed, they indicate that the index of the number is repeated. Negative numbers are never allowed. | ||
<source | <source lang=apl> | ||
⍸ 3 0 2 | ⍸ 3 0 2 | ||
1 1 1 3 3 | 1 1 1 3 3 |