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 allclose all

Basic Examples  (3)

Remove from each list those elements that occur in the other list:

Find letters that are unique to a list of alphabets:

Identify outliers in lists of temporal units:

Properties & Relations  (3)

UniqueElements returns a list of the same length as the input:

UniqueElements[{}] is {}:

UniqueElements[{l1,l2,}] effectively complements each list li with all other lists:

Order of elements in the original lists is preserved, but multiplicity is not:

Wolfram Research (2022), UniqueElements, Wolfram Language function, https://reference.wolfram.com/language/ref/UniqueElements.html.

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_2024_uniqueelements, author="Wolfram Research", title="{UniqueElements}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/UniqueElements.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_uniqueelements, organization={Wolfram Research}, title={UniqueElements}, year={2022}, url={https://reference.wolfram.com/language/ref/UniqueElements.html}, note=[Accessed: 22-November-2024 ]}