>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help Primer

# Result shape

In the previous sections the question of the shape of the result was glossed over. For a monad the frame of the result is the same as the frame of the argument. For a dyad the frame of the result is the frame of the longer of the frames of the arguments (or either frame if they are the same).

With a verb like `+` that has an atom result for each atom argument this is straightforward. Things get more interesting with verbs that have more complicated behavior.

Consider the verb `$` . Look it up in the J Dictionary and you'll see it has rank of `_ 1 _` . The `_` indicates an infinite (unbounded) rank and means that the verb applies to the entire argument. The monad has unbounded rank and so applies to the entire right argument. If you think about the monad `$` with a result that is the shape of its entire right argument this makes sense. The dyad left rank is 1 and this means that it applies to lists from the left argument. The dyad right rank is unbounded and so applies to the entire right argument.

       2 4 $ i.3
    0 1 2 0
    1 2 0 1

       2 4 $"1 0 i.3
    0 0 0 0
    0 0 0 0

    1 1 1 1
    1 1 1 1

    2 2 2 2
    2 2 2 2

The first example is what you have seen before, but what is going on in the second? The `$"1 0` means that `$` will get cell arguments as a list (1-cells) on the left and as an atom (0-cell) on the right. The left frame is empty (nothing is left of the shape of the left argument after a 1-cell is taken) and the right frame is 3 (there are 3 0-cells in the right argument). So the result frame is 3.

    2 4 $ 0   gives   0 0 0 0   left 1-cell $ right 0-cell
                      0 0 0 0

    ... $ 1   gives   1 1 1 1   repeat 1-cell $ next 0-cell
                      1 1 1 1

    ... $ 2   gives   2 2 2 2   repeat 1-cell $ next 0-cell
                      2 2 2 2

The frame of the result is `3` and the things in that frame are `2` by `4` tables, so the shape of the final result is `3 2 4`.

       $ 2 4 $"1 0 i.3
    3 2 4

Rank (noun rank, verb rank, frames, cells, and the rank conjunction) applies to all verbs and greatly increases the ways in which you can use any verb.

>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help Primer