# [`∪`](https://bpl.fast.ai//glyphs/down-shoe.html) — Unique / Union

Function. Keys: `Alt-v`. Hanzi: `并/独` (`併/獨`). Ranks: [`∞`](https://bpl.fast.ai//glyphs/infinity.html) monadic, `∞ ∞` dyadic

`∪Y` keeps the first of each distinct major cell. Uses [tolerant matching](../evaluation.md#equality-and-ordering).

```bpl
∪3 1 3 2 1         ⍝ 3 1 2
```

[`∩`](up-shoe.md) and [`⍷`](epsilon-underbar.md) give the duplicates and positions of the same distinct cells. `≢¨⍷Y` gives how many times each one occurs.

`X∪Y` appends the major cells of `Y` absent from `X`. Both keep their order and repetitions. An atom on the left acts as a one-item vector.

```bpl
1 2∪2 3            ⍝ 1 2 3
1 1∪2 2            ⍝ 1 1 2 2
[1 2◇3 4]∪[3 4◇5 6] ⍝ [1 2◇3 4◇5 6]
```

## Errors

- `RANK`: `X` is a scalar, or the set operation would compare cells of different ranks
- `LENGTH`: the major cells of `X` and `Y` differ in shape
