Shape and Reshape: Difference between revisions

From NARS2000
Jump to navigationJump to search
m (Paul Robinson moved page Reshape to Reshape and Rho: It's monadic and dyadic)
No edit summary
Line 1: Line 1:
==Reshape==
<table border="1" cellpadding="5" cellspacing="0" rules="none" summary="">
<table border="1" cellpadding="5" cellspacing="0" rules="none" summary="">
<tr>
<tr>
Line 30: Line 31:


<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>
==Rho==
The symbol {rho} used with no left argument returns the size or dimensions of a scalar, string, vector, array or matrix.

Revision as of 01:04, 27 November 2014

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.

Rho

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