Strand Assignment: Difference between revisions
From NARS2000
Jump to navigationJump to search
Sudleyplace (talk | contribs) No edit summary |
Sudleyplace (talk | contribs) No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 4: | Line 4: | ||
<table border="0" cellpadding="5" cellspacing="0" summary=""> | <table border="0" cellpadding="5" cellspacing="0" summary=""> | ||
<tr> | <tr> | ||
<td><apll> (A<sub>1</sub> A<sub>2</sub> ... A<sub>n</sub>)←R</apll></td> | <td><apll>(A<sub>1</sub> A<sub>2</sub> ... A<sub>n</sub>)←R</apll></td> | ||
<td></td> | <td></td> | ||
<td></td> | <td></td> | ||
<td>Assigns the successive items of <apll>R</apll> to the names. </td> | <td>Assigns the successive items of <apll>R</apll> to the names.</td> | ||
</tr> | </tr> | ||
</table> | </table> |
Latest revision as of 22:54, 11 April 2008
|
||||
A1 A2 ... An are assignable names, R is a scalar or vector. | ||||
If 1<⍴⍴R, signal a RANK ERROR. | ||||
If R is a scalar or one element vector, its item is assigned to each name, as in Ai←⊃⍬⍴R. | ||||
Otherwise, assume there are n names in the list: | ||||
If n≠⍴R, signal a LENGTH ERROR. | ||||
Otherwise, each successive item of R is assigned to each successive name, as in Ai←i⊃R. |
For example, (A B C)←⊂⍳3 is shorthand for A←B←C←⍳3. In contrast, (A B C)←⍳3 is shorthand for A←1 ⋄ B←2 ⋄ C←3.
Note that (A B)←B A is a simple and efficient way to swap the values of the two names.