Rank in the J programming language has several different meanings. In general, the concept of rank is used to treat an orthogonal array in terms of its sub-arrays. For instance, a two-dimensional array may be dealt with at rank 2 as the entire matrix, or at rank 1 to work with its implicit one-dimensional columns or rows, or at rank 0 to work at the level of its individual atoms.
Nouns, in J, are arrays. The rank of a noun is the number of dimensions of that array. The derived verb #@$ determines the rank of a noun.
Verbs, in J, are functions which take noun arguments and produce noun results. The rank of a verb controls how the verb is applied to nouns with ranks greater than 0. This verb rank is expressed as three numbers:
In all cases, there is some underlying verb definition which applies to cells -- which is to say, sub-arrays of the indicated rank. Or, if the argument doesn't have that many dimensions, the entire argument.
In verbs, negative rank is interpreted as the rank of the noun supplied for that argument less the indicated value. (But never less than zero.)
In the context of a specific verb and a specific noun, the dimensions of that noun are divided into the sequence of prefix dimensions, called the frame, and the sequence of suffix dimensions, called the cells. Positive verb ranks indicate the number of cell dimensions, negative verb ranks indicate the number of frame dimensions.
In the dyadic case, there are two frames -- one for the left argument, and one for the right argument. These frames must agree. Which is to say if the frames are not identical, one must be a prefix of the other. The result of evaluating this verb will have the dimensions of the longest frame as the prefix dimensions of its result. (Trailing result dimensions, if any, would be the result of the verb applied to the relevant cell(s).) In degenerate cases, where the arguments do not have sufficient dimensions, the rank of the verb is effectively reduced (which would influence its result).
For example
Here, the verb + has a rank of 0 0 0, the left argument has a rank of 0, and the right argument has a rank of 1 (with a dimension of 3). Thus, the left argument has a rank 0 frame and the right argument has a rank 1 frame (with a dimension 3). The left argument's (empty) frame is a valid suffix for the right argument's frame, so this is a valid operation. The result has a rank of 1 and a dimension of 3.
The rank conjunction takes a verb left argument and creates a new verb using that as the body of the verb. The right argument specifies the rank of this derived verb.
If the right argument is only two numbers, they are taken as the ranks for the dyadic case, and the second number is used for the monadic case.