2018-05-12 11:39:29 -05:00
|
|
|
---
|
2020-08-14 20:51:06 -05:00
|
|
|
layout: "language"
|
2018-12-19 22:35:11 -06:00
|
|
|
page_title: "distinct - Functions - Configuration Language"
|
2018-05-12 11:39:29 -05:00
|
|
|
sidebar_current: "docs-funcs-collection-distinct"
|
|
|
|
description: |-
|
|
|
|
The distinct function removes duplicate elements from a list.
|
|
|
|
---
|
|
|
|
|
|
|
|
# `distinct` Function
|
|
|
|
|
|
|
|
`distinct` takes a list and returns a new list with any duplicate elements
|
|
|
|
removed.
|
|
|
|
|
2019-03-21 14:20:29 -05:00
|
|
|
The first occurrence of each value is retained and the relative ordering of
|
2018-05-12 11:39:29 -05:00
|
|
|
these elements is preserved.
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
```
|
|
|
|
> distinct(["a", "b", "a", "c", "d", "b"])
|
|
|
|
[
|
|
|
|
"a",
|
|
|
|
"b",
|
|
|
|
"c",
|
|
|
|
"d",
|
|
|
|
]
|
|
|
|
```
|