Vocabulary/StructuralOperations

Joining Arrays

 Joining Arrays What You Want To Do How To Do It Add a new row x to the beginning of table y Use Append x , y Add a new row x to the end of table y Use Append y , x Add a new column x at the left of table y Use Append Items x ,. y Add a new column x at the right of table y Use Append Items y ,. x Join lists a,b,...,y,z as columns of a table Use a,.b,. ... y,.z Join arrays along first axis (axis 0) If the arrays are tables, this joins them vertically Use Append x , y Join arrays along axis 1 If the arrays are tables, this joins them horizontally Use Append Items x ,. y Join arrays along axis a Use Append with Rank x ,"(-a) y Create an array of higher dimension with x as item 0 and y as item 1 Use Laminate x ,: y Join arrays a,b,...y,z as successive items of an array of higher dimension Use a,b, ... y,:z Add empty items to y, where x is a Boolean list where 0 indicates where empty items should go 1 indicates a position to be filled by an item of y. (#y) = +/x x #^:_1 y Add empty items to y, where x gives the number of empties to add before each item followed by the number of empties to add after the last item (#x is one more than #y) x (#^:_1~ }:@((1 #~ #) ;@:(<@({.&1);.1) _1&-))~ y (unwieldy as this looks, it uses little memory) or x (#^:_1~ 1 }.@:#~ 1&j.)~ y (runs fast) Insert items First add empties as above; then use Amend In Place (name =: x m} name) to install the new values Insert empty columns (items of _1-cells), x defined as above x (#^:_1"1 _1~ }:@((1 #~ #) ;@:(<@({.&1);.1) _1&-))~ y Insert empty items into a-cells, x defined as above x (#^:_1"(1,a)~ }:@((1 #~ #) ;@:(<@({.&1);.1) _1&-))~ y

Reshaping Arrays

 Reshaping Arrays What You Want To Do How To Do It Combine the first two axes (axes 0 and 1) ,/ y Combine axes 1 and 2 ,./ y Combine axes in general, where x is a Boolean list of length #\$y with 0 indicating an axis to be combined with the previous axis x ((*/;.1 \$) (\$,) ]) y Reshape y to shape given by x Use Reshape x (\$,) y Add a leading dimension (of length 1) Use Itemize ,: y Reverse the order of items Use Reverse |. y Reverse the order of k-cells Use Reverse with Rank |."k y

Selecting From Arrays

 Selecting From Arrays What You Want To Do How To Do It Select a single item from y Use From x { y Select item(s) x from y x and y may have any shape. The result is an array of items of y Use From x { y Select column x from table y, resulting in a list x {"1 y or (