Rho: Difference between revisions
From NARS2000
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
[[File:APLKB-Rho.png]] | [[File:APLKB-Rho.png]] | ||
Rho may be used as a [[monadic]] or [[dyadic]] operator, depending on the functionality desired. Used monadically with the argument to the right returns the '''shape''' of the argument. Used dyadically, the argument on the left is used to '''reshape''' the argument on the right. | |||
==Shape== | |||
The symbol {rho} used monadically with no left argument returns the shape of the argument to the right, i.e. the size or dimensions of a scalar, string, vector, array or matrix. | |||
==Reshape== | ==Reshape== | ||
<table border="1" cellpadding="5" cellspacing="0" rules="none" summary=""> | <table border="1" cellpadding="5" cellspacing="0" rules="none" summary=""> | ||
Line 36: | Line 43: | ||
<p>The idea for the latter enhancement was taken from Dyalog APL.</p> | <p>The idea for the latter enhancement was taken from Dyalog APL.</p> | ||
{{article footer} | {{article footer} |
Revision as of 20:19, 26 November 2014
⍴ — Shape or Reshape — Keystroke ALT+r — Character 9076
Note: This is ALT+r; ALT+SHIFT+R will generate the symbol root (√).
Rho may be used as a monadic or dyadic operator, depending on the functionality desired. Used monadically with the argument to the right returns the shape of the argument. Used dyadically, the argument on the left is used to reshape the argument on the right.
Shape
The symbol ⍴ used monadically with no left argument returns the shape of the argument to the right, i.e. the size or dimensions of a scalar, string, vector, array or matrix.
Reshape
|
||||
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.
{{article footer}
See Also
NARS 2000 Lang Tool Bar |
← | → | + | - | × | ÷ | * | ⍟ | ⌹ | ○ | ! | ? | √ | | | ⌈ | ⌊ | ⊥ | ⊤ | ⊣ | ⊢ | |||
≡ | ≢ | < | ≤ | = | ≥ | > | ≠ | ∨ | ∧ | ⍱ | ⍲ | ↑ | ↓ | ⊂ | ⊃ | ⌷ | ⍋ | ⍒ | |||||
⍳ | ∊ | ⍸ | ⍷ | ∪ | ∩ | ⊆ | ⊇ | ~ | § | π | .. | , | ⍪ | ⍴ | ⌽ | ⊖ | ⍉ | ||||||
/ | \ | ⌿ | ⍀ | ⊙ | ¨ | ⍨ | ⍤ | ⍣ | ⍡ | ⍥ | ⍦ | . | ∘ | ⍠ | ‼ | ⌻ | ∂ | ∫ | ⍞ | ⎕ | ⍎ | ⍕ | |
⋄ | ⍝ | ∇ | ∆ | ⍙ | _ | ⍺ | ⍵ | ¯ | ⍬ | ∞ | ∅ | ||||||||||||
Second Row | i j k | i j k l | g | p | r | v | x |