github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/docs/job-specification/hcl2/functions/collection/distinct.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: distinct - Functions - Configuration Language
     4  description: The distinct function removes duplicate elements from a list.
     5  ---
     6  
     7  # `distinct` Function
     8  
     9  `distinct` takes a list and returns a new list with any duplicate elements
    10  removed.
    11  
    12  The first occurrence of each value is retained and the relative ordering of
    13  these elements is preserved.
    14  
    15  ## Examples
    16  
    17  ```shell-session
    18  > distinct(["a", "b", "a", "c", "d", "b"])
    19  [
    20    "a",
    21    "b",
    22    "c",
    23    "d",
    24  ]
    25  ```