# Vocabulary/tildedot

 ~. y Nub

Rank Infinity -- operates on x and y as a whole, by items of y -- WHY IS THIS IMPORTANT?

Removes duplicates from a list.

More generally, removes any item of an array that matches a preceding item.

```   ~. 'abracadabra'
abrcd
```

### Common Uses

1. Remove duplicate values from a list

```   ~. 1 3 5 3 5 9 5 2 3 5 7 3 5 7 3
1 3 5 9 2 7
```

2. Remove duplicate rows from a table

```   ]t =. _3 ]\ 1 0 1 1 1 0 1 0 1 0 1 0 1 1 0
1 0 1
1 1 0
1 0 1
0 1 0
1 1 0
~. t
1 0 1
1 1 0
0 1 0
```

3. If f is a costly function, it may be quicker to evaluate f y by first evaluating f~. y (which yields all of the distinct results required), and then distributing them to their appropriate positions. For example:

```   f=: *:
y=: 2 7 1 8 2 8 1 8
f y
4 49 1 64 4 64 1 64

,.&.>(~. ; f@~. ; ((i.~ { f@]) ~.) ; f)y
+-+--+--+--+
|2| 4| 4| 4|
|7|49|49|49|
|1| 1| 1| 1|
|8|64|64|64|
| |  | 4| 4|
| |  |64|64|
| |  | 1| 1|
| |  |64|64|
+-+--+--+--+

NUB=: 1 : '(i.~ { u@]) ~.'           NB. Adverb
*: NUB y
4 49 1 64 4 64 1 64
```

Nub Sieve (~: y)