# Vocabulary/ampdot

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

`[x] u&.v y`Under (Dual) Conjunction

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

Executes `v` on the argument(s) cell-by-cell.

- For each cell,
`u`is applied to the result(s) of`v` - Then
`v^:_1`(i.e. the obverse of`v`) is applied to the result of`u`— giving the result for that cell.

Finally the results for all cells are collected into the end result.

In mathematical terms:

- Verb
`v`defines a*transformation*of the argument(s) (*x*and)*y*into the*v-domain* - Next, verb
`u`operates on the transformed argument(s) - Lastly the result is transformed back from the
*v-domain*to the original domain.

We say that `u` *is applied under* `v` .

**Example:**
Apply (`i.`) to the contents of each box separately, and re-box each result separately

] y =: 1;2;2 3 +-+-+---+ |1|2|2 3| +-+-+---+ u =: i. v =: > u&.v y +-+---+-----+ |0|0 1|0 1 2| | | |3 4 5| +-+---+-----+

### Common uses

1. The most common use of `&.` is `[x] u&.> y` which applies the verb `u` inside each box of the arguments. This follows the rules above: `u&.>` has rank 0 regardless of `u`, so each box is opened separately, operated on, and then reboxed.

Examples:

Convert a list of boxed strings to uppercase

] z =: ;:'alpha bravo charlie' +-----+-----+-------+ |alpha|bravo|charlie| +-----+-----+-------+ toupper&.> z +-----+-----+-------+ |ALPHA|BRAVO|CHARLIE| +-----+-----+-------+

Add the contents of corresponding boxes

]l =. 1;2 3;4 5 6 +-+---+-----+ |1|2 3|4 5 6| +-+---+-----+ ]r =. 3 1 4;1 5;9 +-----+---+-+ |3 1 4|1 5|9| +-----+---+-+ l +&.> r +-----+---+--------+ |4 2 5|3 8|13 14 15| +-----+---+--------+

The standard library defines the name `each` as `&.>`

(<'Mr. ') , each 'Smith';'Jones' +---------+---------+ |Mr. Smith|Mr. Jones| +---------+---------+

`each` is a

- Standard Library word(s) residing in the 'z'-locale
- Defined in the factory script
`stdlib.ijs`which is located in`~system/main/stdlib.ijs` - View the definition(s) in a JQt session by entering:
`open '~system/main/stdlib.ijs'`

2. A useful trick is to use `each` when one or more arguments are not boxed. Since `> y` leaves `y` unchanged if it is not boxed, an unboxed argument will be processed as individual unboxed atoms:

i.&.> 3 4 NB. i. on each atom, boxing results separately +-----+-------+ |0 1 2|0 1 2 3| +-----+-------+ 3 3 4 {. each 'Washington';'Sheffield';'Hereford' +---+---+----+ |Was|She|Here| +---+---+----+ 100 + each 3;1 4;1 5 9 NB. Add 100 inside each box +---+-------+-----------+ |103|101 104|101 105 109| +---+-------+-----------+

### Semiduals `x u&.(a:`v) y` and `x u&.(v`a:) y`

The operation encapsulated by `u&.v` is used often and is important as a notation to aid thought. When the operation is dyadic, sometimes the sequence of transforming/operating/transforming back should be applied to just one argument, with the other argument being passed unchanged into `u`. This can be represented by a gerund form where `a:` indicates which argument is to be used unmodified. The form using `&.` is defined in terms of the infinite-rank version `&.:`:

`x u&.(a:`v) y`is`x u&.:(a:`v)"(`where*lu,mv*)is the left rank of*lu*`u`andis the monadic rank of*mv*`v``x u&.(v`a:) y`is`x u&.:(v`a:)"(`where*mv,ru*)is the right rank of*ru*`u`andis the monadic rank of*mv*`v`

<"2 i. 3 2 4 NB. y is 3 boxes +-------+-----------+-----------+ |0 1 2 3| 8 9 10 11|16 17 18 19| |4 5 6 7|12 13 14 15|20 21 22 23| +-------+-----------+-----------+ 100 200 +"_&.(a:`>) <"2 i. 3 2 4 NB. open y (but not x), add x to each contents, rebox +---------------+---------------+---------------+ |100 101 102 103|108 109 110 111|116 117 118 119| |204 205 206 207|212 213 214 215|220 221 222 223| +---------------+---------------+---------------+ +"_&.(a:`>) b. 0 NB. This works because the left rank of u&.(a:`v) comes from u 0 _ 0

### Related Primitives

Under (`&.:`)

### More Information

1. Under (Dual) (`&.`) differs from Under (`&.:`) in that ` u&.v ` *applies* `u` *under* `v` cell-by-cell,
whereas ` u&.:v ` *applies* `u` *under* `v` to the entire argument(s) (`x` and) `y` .

2. Let `mv` be the monadic rank of `v`. Then:

`u&.v y`is the same as`(u&.:v)"mv y``x u&.v y`is the same as`(u&.:v)"mv y`

### Use These Combinations

Combinations using ` &. y` that have exceptionally good performance include:

**What it does****Type;**

**Precisions;**

Ranks**Syntax****Variants;**

**Restrictions****Benefits;**

**Bug Warnings**Join contents of boxed items along first axis `,&.>/ y`**Bug warning:**Atomic replication is inaccurate. OK if contents of same rank. Better to use`<@; y`Join contents of boxed items along last axis `,.&.>/ y`Bitwise operations on bytes byte `u&.(a.&i.) y``(u y) -: u"0 y`avoids conversion to integer `(m b.)/&.(a.&i.) y`

`x (m b.)&.(a.&i.) y``m`is 16 to 31