> ## Documentation Index
> Fetch the complete documentation index at: https://docs.canton.network/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> If you are building a Canton Network application, start from https://docs.canton.network/appdev/quickstart.md. To run only a local network for your own Daml code, without building the QuickStart demo, see https://docs.canton.network/sdks-tools/development-tools/localnet.md.

# DA.List.BuiltinOrder

> Reference documentation for Daml module DA.List.BuiltinOrder.

Daml module

# DA.List.BuiltinOrder

Note: This is only supported in Daml-LF 1.11 or later.

Daml

Module
DA.List.BuiltinOrder

Latest release
3.7.5

## Functions

### `dedup`

`dedup` : [`Ord`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-classes-ord-6395) `a` => \[`a`] -> \[`a`]

`dedup l` removes duplicate elements from a list. In particular,
it keeps only the first occurrence of each element.

`dedup` is stable so the elements in the output are ordered
by their first occurrence in the input. If you do not need
stability, consider using `dedupSort` which is more efficient.

```
>>> dedup [3, 1, 1, 3]
[3, 1]
```

### `dedupOn`

`dedupOn` : [`Ord`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-classes-ord-6395) `k` => (`v` -> `k`) -> \[`v`] -> \[`v`]

A version of `dedup` where deduplication is done
after applying the given function. Example use: `dedupOn (.employeeNo) employees`.

`dedupOn` is stable so the elements in the output are ordered
by their first occurrence in the input. If you do not need
stability, consider using `dedupOnSort` which is more efficient.

```
>>> dedupOn fst [(3, "a"), (1, "b"), (1, "c"), (3, "d")]
[(3, "a"), (1, "b")]
```

### `dedupSort`

`dedupSort` : [`Ord`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-classes-ord-6395) `a` => \[`a`] -> \[`a`]

`dedupSort` is a more efficient variant of `dedup`
that does not preserve the order of the input elements.
Instead the output will be sorted acoording to the builtin Daml-LF
ordering.

```
>>> dedupSort [3, 1, 1, 3]
[1, 3]
```

### `dedupOnSort`

`dedupOnSort` : [`Ord`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-classes-ord-6395) `k` => (`v` -> `k`) -> \[`v`] -> \[`v`]

`dedupOnSort` is a more efficient variant of `dedupOn`
that does not preserve the order of the input elements.
Instead the output will be sorted on the values returned by the function.

For duplicates, the first element in the list will be included in the output.

```
>>> dedupOnSort fst [(3, "a"), (1, "b"), (1, "c"), (3, "d")]
[(1, "b"), (3, "a")]
```

### `sort`

`sort` : [`Ord`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-classes-ord-6395) `a` => \[`a`] -> \[`a`]

Sort the list according to the Daml-LF ordering.

Values that are identical according to the builtin Daml-LF ordering
are indistinguishable so stability is not relevant here.

```
>>> sort [3,1,2]
[1,2,3]
```

### `sortOn`

`sortOn` : [`Ord`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-classes-ord-6395) `b` => (`a` -> `b`) -> \[`a`] -> \[`a`]

`sortOn f` is a version of sort that allows sorting
on the result of the given function.

`sortOn` is stable so elements that map to the same sort key
will be ordered by their position in the input.

```
>>> sortOn fst [(3, "a"), (1, "b"), (3, "c"), (2, "d")]
[(1, "b"), (2, "d"), (3, "a"), (3, "c")]
```

### `unique`

`unique` : [`Ord`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-classes-ord-6395) `a` => \[`a`] -> [`Bool`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-bool-66265)

Returns True if and only if there are no duplicate elements in the given list.

```
>>> unique [1, 2, 3]
True
```

### `uniqueOn`

`uniqueOn` : [`Ord`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#class-ghc-classes-ord-6395) `k` => (`a` -> `k`) -> \[`a`] -> [`Bool`](https://docs.canton.network/appdev/reference/daml-standard-library/prelude#type-ghc-types-bool-66265)

Returns True if and only if there are no duplicate elements in the given list
after applyng function.

```
>>> uniqueOn fst [(1, 2), (2, 42), (1, 3)]
False
```
