APLX Help : Help on APL language : APL Primitives : , Catenate, Laminate




Twoargument form See also oneargument form Ravel CatenateCatenate joins data items together. With singleelement items and vectors, catenate works very simply. 10,66 (2 numbers are joined to form 10 66 a 2element vector) '10 ','MAY ','1985' (3 vectors of characters are joined 10 MAY 1985 to form an 11element vector) With matrices and other multidimensional arrays, catenate expects the dimension at which the join is made to be specified. (See The dimension at which items are joined must be the same length. Thus if two matrices are joined 'at' the columns dimension, the columns must be the same length. If a scalar is joined to a matrix, it's repeated along the dimension at which the join takes place. The examples below assume Given the following three matrices called A, B, and D A B D 1 2 3 4 5 6 13 14 15 16 17 18 7 8 9 10 11 12 19 20 21 22 23 24 C ← A,B (A and B are joined to form C, C Since no dimension is specified, 1 2 3 4 5 6 the join is at the last dimension 7 8 9 10 11 12 ie the columns. Note that A and B have the same number of rows.) C,[1]D (C and D are joined at the 1 2 3 4 5 6 first dimension, ie at the rows. 7 8 9 10 11 12 Note that C and D have the same 13 14 15 16 17 18 number of columns.) 19 20 21 22 23 24 A,[1]0 (A single number is joined to A. 1 2 3 4 The join is at the row dimension. 7 8 9 10 The number is repeated along that 0 0 0 0 dimension.) LaminateCatenate can only produce a result of the same dimension but of enlarged shape 'ABC',[0.5]'DEF' (Two 3element vectors are joined ABC to form a 2row, 3column matrix. DEF Note the figure in square brackets and the fact that it is less than 1) Laminate creates a new object which has the same shape as the constituent parts except for the addition of a new dimension. So in the example above the original vectors are size 3. Their lamination produces a matrix of size 2 3. The dimension added by laminate is of size 2. This dimension is placed in respect to the old dimension according to the number in brackets. With If the number in brackets is greater than 1, the 2 goes after the old dimension. In the example below, 1.5 is specified. The new dimension of size 2 therefore goes after the existing dimension of size 3, giving a 3row 2column matrix. 'ABC',[1.5]'DEF' AD BE CF If 'ABC',[¯0.5]'DEF' and 'ABC',[0.5]'DEF' respectively 

APLX Help : Help on APL language : APL Primitives : , Catenate, Laminate

Copyright © 19962010 MicroAPL Ltd