This page describes an operation in the collection pipeline pattern. For more context read:

distinct

Removes duplicate elements

Returns a new list with any duplicates removed.

ruby…
[1,2,3,2,1].uniq
# => [1, 2, 3]
clojure…
(distinct [1 2 3 2 1])
;; => (1 2 3)

Some collection frameworks have a separate Set class to handle sets. These automatically remove duplicates and do not have any ordering - which makes them a suitable model for mathematical sets. In these cases you can use a conversion operation to convert the list to a set to remove duplicates - but that won't be suitable if you want to preserve ordering. Other frameworks just use lists to represent sets, relying on the programmer to remove duplicates when needed.

Elements are usually compared using the equality operator. However some languages allow you to supply a lambda for the comparison.

ruby…
["Bach", "Sibelius", "Beethoven", "Elgar", "Schumann"].
  uniq {|c| c[0]}
# => ["Bach", "Sibelius", "Elgar"]