> ## Documentation Index
> Fetch the complete documentation index at: https://cantonfoundation-generated-reference-full-stack-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# DA.List.BuiltinOrder

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

<div class="x2mdx-ref-page x2mdx-ref-page--collection" />

<span id="module-da-list-builtinorder-49213" />

<div class="x2mdx-ref-hero">
  <p class="x2mdx-ref-eyebrow">Daml module</p>

  <h1 class="x2mdx-ref-title">DA.List.BuiltinOrder</h1>

  <p class="x2mdx-ref-summary">Note: This is only supported in Daml-LF 1.11 or later.</p>

  <div class="x2mdx-ref-badges">
    <span class="x2mdx-ref-badge x2mdx-ref-badge--protocol">Daml</span>

    <a class="x2mdx-ref-badge x2mdx-ref-badge--added" href="#history-added-3-4-9">Added 3.4.9</a>
  </div>

  <dl class="x2mdx-ref-meta-grid">
    <div class="x2mdx-ref-meta-item">
      <dt>Module</dt>
      <dd>DA.List.BuiltinOrder</dd>
    </div>

    <div class="x2mdx-ref-meta-item">
      <dt>Latest release</dt>
      <dd>3.5.7</dd>
    </div>
  </dl>
</div>

## Functions

<span id="function-da-list-builtinorder-dedup-38418" />

### `dedup`

`dedup` : [`Ord`](/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]
```

<span id="function-da-list-builtinorder-dedupon-23739" />

### `dedupOn`

`dedupOn` : [`Ord`](/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")]
```

<span id="function-da-list-builtinorder-dedupsort-5846" />

### `dedupSort`

`dedupSort` : [`Ord`](/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]
```

<span id="function-da-list-builtinorder-deduponsort-69087" />

### `dedupOnSort`

`dedupOnSort` : [`Ord`](/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")]
```

<span id="function-da-list-builtinorder-sort-65819" />

### `sort`

`sort` : [`Ord`](/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]
```

<span id="function-da-list-builtinorder-sorton-7978" />

### `sortOn`

`sortOn` : [`Ord`](/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")]
```

<span id="function-da-list-builtinorder-unique-2492" />

### `unique`

`unique` : [`Ord`](/appdev/reference/daml-standard-library/prelude#class-ghc-classes-ord-6395) `a` => \[`a`] -> [`Bool`](/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
```

<span id="function-da-list-builtinorder-uniqueon-93017" />

### `uniqueOn`

`uniqueOn` : [`Ord`](/appdev/reference/daml-standard-library/prelude#class-ghc-classes-ord-6395) `k` => (`a` -> `k`) -> \[`a`] -> [`Bool`](/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
```

## History

<div class="x2mdx-ref-history" aria-label="Reference history">
  <div class="x2mdx-ref-history-event x2mdx-ref-history-event--introduced" id="history-added-3-4-9">
    <div class="x2mdx-ref-history-event-head">
      <span class="x2mdx-ref-history-event-label">Added</span>
      <code class="x2mdx-ref-history-event-version">3.4.9</code>
    </div>
  </div>
</div>
