Strand Assignment: Difference between revisions

From NARS2000
Jump to navigationJump to search
(New page: <table border="1" cellpadding="5" cellspacing="0" rules="none" summary=""> <caption>'''Strand Assignment'''</caption> <tr> <td> <table border="0" cellpadding="5" cellspacing="0" summ...)
 
No edit summary
Line 5: Line 5:
     <table border="0" cellpadding="5" cellspacing="0" summary="">
     <table border="0" cellpadding="5" cellspacing="0" summary="">
     <tr>
     <tr>
       <td><apl size="large"> (A1 A2 ... An){is}R</apl></td>
       <td><apl size="large"> (A<sub>1</sub> A<sub>2</sub> ... A<sub>n</sub>){is}R</apl></td>
       <td></td>
       <td></td>
       <td></td>
       <td></td>
Line 14: Line 14:
</tr>
</tr>
<tr>
<tr>
   <td><apl size="large">A1 A2 ... An</apl> are assignable names, <apl size="large">R</apl> is a scalar or vector.
   <td><apl size="large">A<sub>1</sub> A<sub>2</sub> ... A<sub>n</sub></apl> are assignable names, <apl size="large">R</apl> is a scalar or vector.
   </td>
   </td>
</tr>
</tr>
Line 21: Line 21:
</tr>
</tr>
<tr>
<tr>
   <td>If <apl size="large">R</apl> is a scalar or one element vector, its item is assigned to each name, as in <apl size="large">Ai{is}{disclose}{zilde}{rho}R</apl>.</td>
   <td>If <apl size="large">R</apl> is a scalar or one element vector, its item is assigned to each name, as in <apl size="large">A<sub>i</sub>{is}{disclose}{zilde}{rho}R</apl>.</td>
</tr>
</tr>
<tr>
<tr>
Line 30: Line 30:
</tr>
</tr>
<tr>
<tr>
   <td>Otherwise, each successive item of <apl size="large">R</apl> is assigned to each successive name, as in <apl size="large">Ai{is}i{disclose}R</apl>.</td>
   <td>Otherwise, each successive item of <apl size="large">R</apl> is assigned to each successive name, as in <apl size="large">A<sub>i</sub>{is}i{disclose}R</apl>.</td>
</tr>
</tr>
</table>
</table>

Revision as of 08:42, 9 April 2008

Strand Assignment
(A1 A2 ... An)←R Assigns the successive items of R to the names.
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 assigns ⍳3 to each of the names A, B, and C
Also, (A B C)←(1 2)'abc' 1.1 is the same as A←1 2 ⋄ B←'abc' ⋄ C←1.1