WOLFRAM

DisjointQ[list1,list2]

yields True if list1 and list2 do not share any common elements, and False otherwise.

Details and Options

  • DisjointQ works for expressions with heads other than List.
  • When applied to associations, DisjointQ compares their values.
  • DisjointQ[list1,list2,SameTesttest] applies test to each pair of elements in the listi to determine whether they should be considered the same.

Examples

Basic Examples  (1)Summary of the most common use cases

Test whether lists share no elements:

Out[1]=1
Out[2]=2
Wolfram Research (2014), DisjointQ, Wolfram Language function, https://reference.wolfram.com/language/ref/DisjointQ.html (updated 2022).
Wolfram Research (2014), DisjointQ, Wolfram Language function, https://reference.wolfram.com/language/ref/DisjointQ.html (updated 2022).

Text

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

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

CMS

Wolfram Language. 2014. "DisjointQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/DisjointQ.html.

Wolfram Language. 2014. "DisjointQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/DisjointQ.html.

APA

Wolfram Language. (2014). DisjointQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DisjointQ.html

Wolfram Language. (2014). DisjointQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DisjointQ.html

BibTeX

@misc{reference.wolfram_2025_disjointq, author="Wolfram Research", title="{DisjointQ}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/DisjointQ.html}", note=[Accessed: 07-June-2025 ]}

@misc{reference.wolfram_2025_disjointq, author="Wolfram Research", title="{DisjointQ}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/DisjointQ.html}", note=[Accessed: 07-June-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_disjointq, organization={Wolfram Research}, title={DisjointQ}, year={2022}, url={https://reference.wolfram.com/language/ref/DisjointQ.html}, note=[Accessed: 07-June-2025 ]}

@online{reference.wolfram_2025_disjointq, organization={Wolfram Research}, title={DisjointQ}, year={2022}, url={https://reference.wolfram.com/language/ref/DisjointQ.html}, note=[Accessed: 07-June-2025 ]}