Rho: Difference between revisions

From NARS2000
Jump to navigationJump to search
m (Paul Robinson moved page Symbol Rho to Rho: Fleshed out enough to become a full named symbol)
No edit summary
Line 4: Line 4:


[[File:APLKB-Rho.png]]
[[File:APLKB-Rho.png]]
==Usage==
==Reshape==
==Example==
<table border="1" cellpadding="5" cellspacing="0" rules="none" summary="">
<tr>
  <td>
    <table border="0" cellpadding="5" cellspacing="0" summary="">
    <tr>
      <td valign="top"><apll>Z←L⍴R</apll></td>
      <td></td>
      <td></td>
      <td>returns an array of shape <apll>L</apll> whose items are taken from <apll>R</apll> in row major order, repeated as necessary.</td>
    </tr>
    </table>
  </td>
</tr>
<tr>
  <td><apll>L</apll> is a scalar or vector of non-negative integers, and <apll>R</apll> is an arbitrary array.</td>
</tr>
<tr>
  <td>If the right argument is empty, the result consists of <apll>×/⍴L</apll> copies of the fill item of <apll>R</apll>.
</tr>
</table>
<br />
<p>For example, in origin-1</p>
 
<apll>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 3⍴⍳6<br />
&nbsp;1 2 3<br />
&nbsp;4 5 6<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 3⍴⍳0<br />
&nbsp;0 0 0<br />
&nbsp;0 0 0<br /></apll>
 
<p>The idea for the latter enhancement was taken from Dyalog APL.</p>
 
==Shape==
The symbol {rho} used with no left argument returns the size or dimensions of a scalar, string, vector, array or matrix.
 
{{article footer}
[[Category:Monadic Operators]]
[[Category:Dyadic Operators]]
 
==See Also==
==See Also==



Revision as of 21:13, 26 November 2014

⍴ — Shape or Reshape — Keystroke ALT+r — Character 9076

Note: This is ALT+r; ALT+SHIFT+R will generate the symbol root (√).

APLKB-Rho.png

Reshape

Z←L⍴R returns an array of shape L whose items are taken from R in row major order, repeated as necessary.
L is a scalar or vector of non-negative integers, and R is an arbitrary array.
If the right argument is empty, the result consists of ×/⍴L copies of the fill item of R.


For example, in origin-1

      2 3⍴⍳6
 1 2 3
 4 5 6
      2 3⍴⍳0
 0 0 0
 0 0 0

The idea for the latter enhancement was taken from Dyalog APL.

Shape

The symbol ⍴ used with no left argument returns the size or dimensions of a scalar, string, vector, array or matrix.

{{article footer}

See Also

{{#ifeq:{{{en}}}|4||title="match" style="border-width:thick; border-color:blue; background-color:yellow;"| {{#ifeq:{{{en}}}|7||title="iota" style="border-width:thick; border-color:blue; background-color:yellow;" | {{#ifeq:{{{en}}}|9||title="slash" style="border-width:thick; border-color:blue; background-color:yellow;" |/ {{#ifeq:{{{en}}}|11||title="diamond" style="border-width:thick; border-color:blue; background-color:yellow;" | {{#switch: {{{en}}}
NARS 2000 Lang
Tool
Bar

{{#ifeq:{{{en}}}|1||title="assign" style="border-width:thick; border-color:blue; background-color:yellow;" |

bgcolor=cyan title="assign" | }}

{{#ifeq:{{{en}}}|2||title="plus" style="border-width:thick; border-color:blue; background-color:yellow;" |+

- × ÷ * ! ? bgcolor=cyan title="plus" |+ - × ÷ * ! ? }}

{{#ifeq:{{{en}}}|3||title="mod" style="border-width:thick; border-color:blue; background-color:yellow;" ||

< = > bgcolor=cyan title="match" | < = > }}

{{#ifeq:{{{en}}}|5||title="down caret" style="border-width:thick; border-color:blue; background-color:yellow;" |

bgcolor=cyan title="down caret" | }}

{{#ifeq:{{{en}}}|6||title="take" style="border-width:thick; border-color:blue; background-color:yellow;" |

~ § π .. bgcolor=cyan title="iota" | ~ § π .. }}

{{#ifeq:{{{en}}}|8||title="comma" style="border-width:thick; border-color:blue; background-color:yellow;" |,

\ ¨ . bgcolor=cyan title="slash" |/ \ ¨ . }}

{{#ifeq:{{{en}}}|10||title="quotequad" style="border-width:thick; border-color:blue; background-color:yellow;" |

_ bgcolor=cyan title="diamond" | _ }}

{{#ifeq:{{{en}}}|12||title="neg" style="border-width:thick; border-color:blue; background-color:yellow;" |¯

title="neg" |¯
colspan=8 |Second Row i j k a b e g p r v x z colspan=8 |Second Row i j k a b e g p r v x z colspan=8 |Second Row i j k a b e g p r v x z colspan=6 |Second Row i j k i j k l g p r v x

}}