Leading axis agreement

Leading axis agreement, sometimes called prefix agreement, is a conformability rule designed for leading axis theory and used by J and BQN. It states that a dyadic scalar function can be applied between two arrays only if one of their shapes is a prefix of the other. The shape of the result is that of the argument with higher rank. In J, since all functions, including dyadic scalar functions, have rank, leading axis agreement is a special case of frame agreement.

Examples
The following examples use J for demonstration purposes.

A scalar dyadic function works when the two arrays have the same shape:

as well as when one is a scalar:

The two cases above are already supported in other APLs in the form of scalar extension. J goes one step further, allowing the lower-rank array argument to have nonzero rank, as long as the leading dimensions match:

In this case,  has shape   and   has shape. Since the leading axes agree and the rank difference is 1, each atom (or 0-cell) of  is matched with each row (or 1-cell) of , and the two rows in the result are the results of   and  , respectively.

Model
In dialects that do not feature leading axis agreement, it can nevertheless be utilised by the introduction of an explicit operator:

Aligning axes using the Rank operator
When using the Rank operator for dyadic functions as in, the frames of   and   are checked for conformability. Combined with leading axis agreement, the Rank operator can be used to align the axes to be matched.