Modify Strand Assignment: Difference between revisions

From NARS2000
Jump to navigationJump to search
No edit summary
No edit summary
 
(2 intermediate revisions 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>)<i>fn</i>←R</apll></td>
       <td><apll>(A<sub>1</sub> A<sub>2</sub> ... A<sub>n</sub>)<i>f</i>←R</apll></td>
       <td></td>
       <td></td>
       <td></td>
       <td></td>
       <td>In general, assigns <apll>A<sub>i</sub>←A<sub>i</sub><i>fn</i> i⊃R</apll>. </td>
       <td>In general, assigns <apll>A<sub>i</sub>←A<sub>i</sub><i>f</i> i⊃R</apll>. </td>
     </tr>
     </tr>
     </table>
     </table>
Line 13: Line 13:
</tr>
</tr>
<tr>
<tr>
   <td><apll>A<sub>1</sub> A<sub>2</sub> ... A<sub>n</sub></apll> are all names with existing values, <apll>R</apll> is a scalar or vector.
   <td><apll>A<sub>1</sub> A<sub>2</sub> ... A<sub>n</sub></apll> are all names with existing values, <apll><i>f</i></apll> is an arbitrary dyadic function, and <apll>R</apll> is a scalar or vector.
   </td>
   </td>
</tr>
</tr>
Line 20: Line 20:
</tr>
</tr>
<tr>
<tr>
   <td>If <apll>R</apll> is a scalar or one element vector, its item, in combination with the value of each name, is assigned to each name, as in <apll>A<sub>i</sub>{is}A<sub>i</sub><i>fn</i> ⊃⍬⍴R</apll>.</td>
   <td>If <apll>R</apll> is a scalar or one element vector, its item, in combination with the value of each name, is assigned to each name, as in <apll>A<sub>i</sub>{is}A<sub>i</sub><i>f</i> ⊃⍬⍴R</apll>.</td>
</tr>
</tr>
<tr>
<tr>
Line 29: Line 29:
</tr>
</tr>
<tr>
<tr>
   <td>Otherwise, each successive item of <apll>R</apll>, in combination with the value of each successive name, is assigned to each successive name, as in <apll>A<sub>i</sub>←A<sub>i</sub><i>fn</i> i⊃R</apll>.</td>
   <td>Otherwise, each successive item of <apll>R</apll>, in combination with the value of each successive name, is assigned to each successive name, as in <apll>A<sub>i</sub>←A<sub>i</sub><i>f</i> i⊃R</apll>.</td>
</tr>
</tr>
</table>
</table>
<br />
<br />
<br />
<p>For example, <apll>(A B C)⍴←⊂⍳3</apll> is shorthand for <apll>A←A⍴⍳3 ⋄ B←B⍴⍳3 ⋄ C←C⍴⍳3</apll>.  In contrast, <apll>(A B C)⍴←⍳3</apll> is shorthand for <apll>A←A⍴1 ⋄ B←B⍴2 ⋄ C←C⍴3</apll>.</p>
For example, <apll>(A B C)⍴←⊂⍳3</apll> is shorthand for <apll>A←A⍴⍳3 ⋄ B←B⍴⍳3 ⋄ C←C⍴⍳3</apll>.  In contrast, <apll>(A B C)⍴←⍳3</apll> is shorthand for <apll>A←A⍴1 ⋄ B←B⍴2 ⋄ C←C⍴3</apll>.

Latest revision as of 22:57, 11 April 2008

(A1 A2 ... An)f←R In general, assigns Ai←Aif i⊃R.
A1 A2 ... An are all names with existing values, f is an arbitrary dyadic function, and R is a scalar or vector.
If 1<⍴⍴R, signal a RANK ERROR.
If R is a scalar or one element vector, its item, in combination with the value of each name, is assigned to each name, as in Ai←Aif ⊃⍬⍴R.
Otherwise, assume there are n names in the list:
If n≠⍴R, signal a LENGTH ERROR.
Otherwise, each successive item of R, in combination with the value of each successive name, is assigned to each successive name, as in Ai←Aif i⊃R.


For example, (A B C)⍴←⊂⍳3 is shorthand for A←A⍴⍳3 ⋄ B←B⍴⍳3 ⋄ C←C⍴⍳3. In contrast, (A B C)⍴←⍳3 is shorthand for A←A⍴1 ⋄ B←B⍴2 ⋄ C←C⍴3.