UniqueElements[{list1,list2,…}]
gives the elements for each listi that are not in any other list.
UniqueElements[lists,test]
uses test to determine whether pairs of elements should be considered equivalent.
UniqueElements
UniqueElements[{list1,list2,…}]
gives the elements for each listi that are not in any other list.
UniqueElements[lists,test]
uses test to determine whether pairs of elements should be considered equivalent.
Details
- UniqueElements[{list1,list2,…,listn}] returns another list of length n, with elements being sublists of the corresponding inputs lists.
- Order of elements in the original lists is preserved in output. Multiplicity is not preserved.
- The listi must have the same head, but it need not be List.
Examples
open all close allBasic Examples (3)
Remove from each list those elements that occur in the other list:
UniqueElements[{{1, 2, 2, b, b, a}, {4, 3, 2, 1}}]Find letters that are unique to a list of alphabets:
UniqueElements[Alphabet /@ {"English", "Spanish", "French", "Romanian", "Polish"}]Identify outliers in lists of temporal units:
UniqueElements[{{"Years", "Months", "Days"}, {"Hours", "Minutes", "SecondsOfRightAscension"}}, CompatibleUnitQ]Properties & Relations (3)
UniqueElements returns a list of the same length as the input:
UniqueElements[{{1, 2, 3, 4}, {2, 3, 4, 5}, {3, 4, 5, 6}}]UniqueElements[{}] is {}:
UniqueElements[{}]UniqueElements[{l1,l2,…}] effectively complements each list li with all other lists:
l1 = {c, b, a, b, d};
l2 = {g, f, d, g, f};
l3 = {d, c, b, d, e};{Complement[l1, l2, l3], Complement[l2, l1, l3], Complement[l3, l1, l2]}Order of elements in the original lists is preserved, but multiplicity is not:
UniqueElements[{l1, l2, l3}]Related Guides
History
Text
Wolfram Research (2022), UniqueElements, Wolfram Language function, https://reference.wolfram.com/language/ref/UniqueElements.html.
CMS
Wolfram Language. 2022. "UniqueElements." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/UniqueElements.html.
APA
Wolfram Language. (2022). UniqueElements. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/UniqueElements.html
BibTeX
@misc{reference.wolfram_2026_uniqueelements, author="Wolfram Research", title="{UniqueElements}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/UniqueElements.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_uniqueelements, organization={Wolfram Research}, title={UniqueElements}, year={2022}, url={https://reference.wolfram.com/language/ref/UniqueElements.html}, note=[Accessed: 13-June-2026]}