# Vocabulary/ampv

>>
<< ` `
Back to: Vocabulary
Thru to: Dictionary

`[x] u&v y`Compose Conjunction

Rank *-- depends on the rank of v --*
WHY IS THIS IMPORTANT?

Applies `v` to each **cell** of each argument, and then applies `u` to the result(s) of `v` **for each cell separately**

('Ike';'James') >&#&> ('Newton';'Bond') NB. Is first name longer than last name? 0 1

This contrasts with `u&:v` which applies `v` to the entire argument(s) and then applies `u` on the entire result(s) of `v` .

- Operand
`v`is executed monadically. - Operand
`u`is executed either monadically or dyadically depending whether`u&v`has been called monadically or dyadically.

See: **More Information** for a visual comparison of At (`@:`), Atop (`@`), Compose (`&`) and Appose (`&:`).

### Common Uses

Monadic

**The monadic use of & is deprecated. Use @ instead.** Some compounds of the form

`f&g`are not recognized for special code in places where

`f@g`is recognized, if only the monadic form of the compounds is eligible for special treatment.

*:&+: 3 4 5 NB. double, then square. Applied to each atom 36 64 100 *: +: 3 4 5 NB. Same result if applied to entire list 36 64 100 +/&+: 3 4 5 NB. Double, then "total". Applied to each atom. 6 8 10 +/ +: 3 4 5 NB. Not the same if applied to entire list! 24

Dyadic

]firstname =: 'Dennis';'Richard';'Ken' +------+-------+---+ |Dennis|Richard|Ken| +------+-------+---+ ]lastname =: 'Ritchie';'Stallman';'Iverson' +-------+--------+-------+ |Ritchie|Stallman|Iverson| +-------+--------+-------+ firstname ,&> lastname NB. Join each first name to last, individually DennisRitchie RichardStallman KenIverson (>firstname) , (>lastname) NB. very different applied to entire array Dennis Richard Ken Ritchie Stallman Iverson firstname (>@[ , >@])"0 lastname NB. equivalent form DennisRitchie RichardStallman KenIverson

### Related Primitives

Atop (`@`),
At (`@:`),
Appose (`&:`),
Hook (`(u v)`),
Fork (`(f g h)`)

### More Information

1. (`[x] u&v y`) is the same as (`[x] u&:v"mv y`) (where `mv` is the monadic rank of `v`).

The second phrase uses Appose (`&:`) instead of **Compose** (`&`).

An illustration of the process follows, extracted from the series of diagrams referenced below:

2. The difference between Appose (`u&:v`) and **Compose** (`u&v`) is shown in the **last two** columns of the diagram below:

The above diagram also shows At (`@:`) and Atop (`@`) for overall comparison.

These four are also visualized along with verb application and rank here: a series of flow diagrams

3. So what's the difference between Atop (`@`) and Compose (`&`) ?

None at all, for the *monads* (`u@v`) and (`u&v`)

u&v y ↔ u v y u@v y ↔ u v y

But thedyadsare different

x u&v y ↔ (v x) u (v y) x u@v y ↔ u x v y

According to the J Dictionary -- `&:` *is equivalent to* `&` *except that the ranks of the resulting function are infinite; the relation is similar to that between* `@:` *and* `@`

### Oddities

1. The J Dictionary states that `u&v y <==> u v y` and `x u&v y <==> (v x) u (v y)`, but these statements assume that `u&v` is applied at the rank `mv` as defined above.

The correct equivalences for `u&v` are given above.

2. Note also that in u&f&v, f will be applied monadically. If the whole expression is called dyadically, then v is applied to each argument, f applied monadically to each result of v, and then u applied dyadically to the results. Equivalent to fork (f@v@[ u f@v@]).