## " (Rank) Conjunction

Given a verb u (monadic) and a single integer n, the adverb ("n) creates a new verb (u"n) which applies the original verb u to n-cells (chunks of rank n) of its argument y.

More generally, given a verb u (dyadic) and a list n of three integers: (n0 n1 n2), the adverb ("n) creates a new verb (u"n) which applies the original verb u to n1-cells of its left-argument x, and to n2-cells of its right-argument y.

Note these two important variations of ("n):

• If n is not a 3-list but a single integer, it serves as the value of all 3 integers (n0 n1 n2)

• Given any verb v, the adverb ("v) is equivalent to ("n) where n is the rank of v.

For a more relaxed explanation of Rank, see Rank in a hurry, which contains links to more authoritative treatments of the concept of Rank and its uses.

### Common uses

1. Sum a 2-D array across rather than down.

```   ]z=: i.2 2
0 1
2 3
+/z
2 4
+/"1 z
1 5```

2. Box the atoms (or the rows) of a table y instead of the whole of y

```   <z
┌───┐
│0 1│
│2 3│
└───┘
<"1 z
┌───┬───┐
│0 1│2 3│
└───┴───┘
<"0 z
┌─┬─┐
│0│1│
├─┼─┤
│2│3│
└─┴─┘```

3. Construct an array of the same shape as z, but having 1 for every atom in z

```   ]z=: i.2 3
0 1 2
3 4 5
1"0 z
1 1 1
1 1 1
z=: 2 3 \$ 'abcdef'
1"0 z
1 1 1
1 1 1```

4. Make a "constant" verb out of a given noun, which always returns the noun whatever the value of its y-argument (and optional x-argument)

• Such a verb can simplify the creation of a tacit phrase which needs the value of a given noun at some point in the calculation.

```   zero=: 0"_
zero 98 99
0
'abc' zero 98 99
0```

5. The standard library verb bind uses Rank (") to attach a constant argument to some other verb.

• The example shows a GUI handler which is still to be implemented, meanwhile displaying a message in the J session.

```   fm_cancel_button=: smoutput bind '>>> Cancel is not implemented'
fm_cancel_button
smoutput@('>>> Cancel is not implemented'"_)

fm_cancel_button''
>>> Cancel is not implemented```

See also: Constant Function (0:), plus built-in sister verbs replacing 0 with integers in i:9, also _ and __. These are equivalent to 0"_ , 1"_ , etc.

### See Also

Vocabulary/quote (last edited 2013-12-07 22:52:23 by IanClark)