Indexing: Difference between revisions
From NARS2000
Jump to navigationJump to search
Sudleyplace (talk | contribs) (New page: <table border="1" cellpadding="5" cellspacing="0" rules="none" summary=""> <tr> <td> <table border="0" cellpadding="5" cellspacing="0" summary=""> <tr> <td><apll>Z←R[L]</...) |
Sudleyplace (talk | contribs) No edit summary |
||
Line 4: | Line 4: | ||
<table border="0" cellpadding="5" cellspacing="0" summary=""> | <table border="0" cellpadding="5" cellspacing="0" summary=""> | ||
<tr> | <tr> | ||
<td><apll>Z←R[L]</apll>, <apll>R[L]←A</apll>, and <apll>R[L]<i>f</i>←A | <td><apll>Z←R[L]</apll>, <apll>R[L]←A</apll>, and <apll>R[L]<i>f</i>←A</apll></td> | ||
<td></td> | <td></td> | ||
<td></td> | <td></td> | ||
Line 22: | Line 22: | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
<td>If <apll>L⊃R</apll> is valid, it is equivalent to <apll>⊃R[⊂L]</apll> | <td><b>Reach Indexing</b>: If <apll>L⊃R</apll> is valid, it is equivalent to <apll>⊃R[⊂L]</apll></td> | ||
</tr> | |||
<tr> | |||
<td><b>Scatter Indexing</b>: If <apll>L⌷R</apll> is valid, it is equivalent to <apll>R[⊃∘.,/L]</apll></td> | |||
</tr> | |||
<tr> | |||
<td>Both Reach and Scatter indexing may appear together within a single instance of <apll>R[L]</apll>, <apll>R[L]←A</apll>, and <apll>R[L]<i>f</i>←A</apll></td> | |||
</tr> | </tr> | ||
</table> | </table> | ||
Line 28: | Line 34: | ||
<p>For example, in origin-1</p> | <p>For example, in origin-1</p> | ||
<apll> V←'123'(⊂4 5)</apll><br /> | |||
<apll> V[1 (2 ⍬ 1)]</apll><br /> | |||
<apll> 123 4</apll> | |||
<table border="1" cellpadding="5" cellspacing="0" rules="none" summary=""> | |||
<tr> | |||
<td> | |||
<table border="0" cellpadding="5" cellspacing="0" summary=""> | |||
<tr> | |||
<td><apll>Z←R[L]</apll>, <apll>R[L]←A</apll>, <apll>R[L]<i>f</i>←A</apll>, <apll>L⌷R</apll>, and <apll>L⊃R</apll></td> | |||
<td></td> | |||
<td></td> | |||
<td>are all extended to allow negative index values.</td> | |||
</tr> | |||
</table> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td><apll>L</apll> is a nested array of integer scalars and/or vectors, suitable for indexing <apll>R</apll>.</td> | |||
</tr> | |||
<tr> | |||
<td>That is, if the largest allowed index value is <apll>N</apll>, then the previous allowable range of values was <apll>⎕IO</apll> to <apll>N</apll>, inclusive. Now, the allowable range of values is <apll>1 ¯1[1]-N</apll> to <apll>N</apll>, inclusive. For example, <apll>A</apll>, <apll>A[⍳⍴A]</apll>, and <apll>A[⍳-⍴A]</apll> are all identical for any array <apll>A</apll> in either origin.</td> | |||
</tr> | |||
<tr> | |||
<td><apll>R</apll> is an arbitrary array.</td> | |||
</tr> | |||
<tr> | |||
<td><apll>A</apll> is an arbitrary array.</td> | |||
</tr> | |||
</table> | |||
<br /> | |||
<p>For example, in origin-1</p> | |||
<apll> V←'123'(⊂4 5)</apll><br /> | |||
<apll> V[¯1 (0 ⍬ 1)]</apll><br /> | |||
<apll> 123 4</apll> |
Revision as of 15:56, 13 April 2008
|
||||
L is a nested array of integer scalars and/or vectors, suitable for indexing R. | ||||
R is an arbitrary array. | ||||
A is an arbitrary array. | ||||
Reach Indexing: If L⊃R is valid, it is equivalent to ⊃R[⊂L] | ||||
Scatter Indexing: If L⌷R is valid, it is equivalent to R[⊃∘.,/L] | ||||
Both Reach and Scatter indexing may appear together within a single instance of R[L], R[L]←A, and R[L]f←A |
For example, in origin-1
V←'123'(⊂4 5)
V[1 (2 ⍬ 1)]
123 4
|
||||
L is a nested array of integer scalars and/or vectors, suitable for indexing R. | ||||
That is, if the largest allowed index value is N, then the previous allowable range of values was ⎕IO to N, inclusive. Now, the allowable range of values is 1 ¯1[1]-N to N, inclusive. For example, A, A[⍳⍴A], and A[⍳-⍴A] are all identical for any array A in either origin. | ||||
R is an arbitrary array. | ||||
A is an arbitrary array. |
For example, in origin-1
V←'123'(⊂4 5)
V[¯1 (0 ⍬ 1)]
123 4