APLX Help : Help on APL language : APL Primitives : \ Expand




When used with a simple numeric scalar or vector operand, the Twoargument form onlyInserts the array prototype. If the left argument consists of 1's and 0's, each 0 causes a space or 0 to be put in the corresponding position in the right argument. There must be as many 1's in the left argument as there are elements in the right argument. 1 1 1 0 1 1 1\'PIGDOG' (The 1's represent the existing PIG DOG characters in the right argument. The 0 shows where a space is to go) TABLE 1 2 3 4 5 6 7 8 9 10 0 1 1 1 1 1 \ TABLE (Each row is to have a 0 inserted 0 1 2 3 4 5 before the existing numbers. Note 0 6 7 8 9 10 that the last axis is assumed) The expansion function applies by default to the last axis, unless used in conjunction with the axis operator, 1 0 1 \[1] TABLE (Using the other axis, the 1 2 3 4 5 same as 1 0 1⍀TABLE) 0 0 0 0 0 6 7 8 9 10 If the left argument includes numbers other than 1 or 0, a positive number specifies how many of the corresponding element to insert, and a negative number specifies the number of prototype elements to insert. There must be as many positive numbers in the left argument as there are numbers in the right argument. (See replicate under 1 0 3 ¯2 5\ 3 8 2 (1 copy of first element, then 1 prototype, 3 0 8 8 8 0 0 2 2 2 2 2 3 copies of second element, 2 prototypes 5 copies of third element. VEC←(2 2⍴⍳4) 3 4 5 6 (Prototype is a simple numeric matrix 1 1 0 1 1 1\VEC shape 2 2 and is used by expand) 1 2 3 0 0 4 5 6 3 4 0 0 

APLX Help : Help on APL language : APL Primitives : \ Expand

Copyright © 19962010 MicroAPL Ltd