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

# distinct

> Remove duplicate values from a list.

`distinct(list)` returns a new list with duplicate values removed. The first occurrence of each value is kept.

## Signature

```
distinct(list list) list
```

## Example

Combine package lists from multiple variables and ensure no package appears twice before passing the list to a build command:

```hcl theme={null}
variable "base_packages" {
  type    = list(string)
  default = ["./cmd/api", "./cmd/worker"]
}

variable "extra_packages" {
  type    = list(string)
  default = ["./cmd/worker", "./cmd/scheduler"]
}

computed "packages" {
  description = "Deduplicated list of packages to build"
  expression  = distinct(concat(var.base_packages, var.extra_packages))
}

task "build" {
  description = "Build all unique packages"
  commands    = ["go build ${join(" ", computed.packages)}"]
}
```

`["./cmd/api", "./cmd/worker", "./cmd/scheduler"]` is the result, with the duplicate `./cmd/worker` removed.

## Notes

* Order is preserved based on first occurrence.
* `distinct` works on lists of any comparable element type.
