[top][index]
search for:

unique -- eliminate duplicates from a list

unique v -- yields the elements of the list v, without duplicates.

i1 : unique {3,2,1,3,2,4,a,3,2,3,-2,1,2,4}

o1 = {3, 2, 1, 4, a, -2}

o1 : List

The order of elements is maintained. For something that might be slightly faster, but doesn't maintain the order of the elements, and may different answers, try making a set and then getting its elements.

i2 : toList set {3,2,1,3,2,4,a,3,2,3,-2,1,2,4}

o2 = {a, 1, 2, 3, 4, -2}

o2 : List

See also:

  • sort -- sort a list
  • Class of returned value: List -- the class of all lists -- {...}Ways to use unique :

  • unique Sequence
  • unique List

  • [top][index]
    search for: