Raze


 * The Right Shoe symbol  is more commonly used for First or Mix.

,  in J, or Join  in BQN, is a monadic function which combines element arrays of a nested vector along the first axis (in accordance with leading axis theory). Thus, the major cells of the Raze of an array are the major cells of its element arrays: unlike Mix, which removes a level of depth while keeping outer and inner axes separate, Raze merges the outer vector's axis with the first axis of each element. Raze is present in A+, J, and BQN.

Examples
Raze can turn a vector of vectors into a single vector. Unlike Mix, it inserts no fill elements.

When elements of the argument have rank more than 1, Raze combines them along the leading axis, like Catenate First. In A+, the elements must have the same rank and major cell shape or an error results; in J, lower-rank arrays are promoted to a higher rank and arrays are padded with fills to a common major cell shape.

Properties
Raze is similar to the Catenate reduction. If  is a vector whose elements have equal and positive rank, then   is the Raze of. The definition differs if  is a singleton vector with scalar elements, because the Raze of   will be a vector while the reduction implementation results in a scalar (or, in NARS2000, a DOMAIN ERROR). This is because Raze treats scalar elements of its argument as singleton vectors, a convention which may be viewed as scalar rank extension or as a result of the idea that a scalar's only major cell is itself.

Raze is the inverse of Partition and Partitioned Enclose on vectors: partitioning, then razing, a vector gives that vector back. It is also an inverse to partition functions which partition major cells along the first axis, although few partition functions do this.

High-rank extension
Raze can be extended to an argument array of rank greater than 1, allowing it to merge block matrices or higher-dimensional structures. This extension is part of BQN, but has not been implemented in any APL, and would not be backwards-compatible in J, since J's Raze implicitly ravels its argument.

The axes of a high-rank argument should be paired with those of its element arrays, starting at the first axis (much like prefix agreement). The elements can be merged without adding fills when the length of an element along a particular axis depends only on its position along that axis in the outer array. That is, in,   must match  , where S is a vector containing   vectors followed by any number of scalars. In this case, the shape of  is. The result can be computed by performing a modified 1-dimensional Raze several times. The modified Raze should maintain some number of leading inner element axes. With the Rank operator we might write   for a single step in the process, thus reducing along the last axis and catenating along the same axis.

If the element arrays of  do not satisfy the shape requirements, they could be padded with fills to force this requirement to hold.

Documentation

 * J Dictionary, NuVoc
 * BQN