CountDistinct
CountDistinct[list]
gives the number of distinct elements that appear in list.
CountDistinct[list,test]
applies test to pairs of elements to determine whether they should be considered equivalent.
Details
- CountDistinct[<key1val1,key2val2,… >] gives the number of distinct vali.
- CountDistinct[list] is equivalent to CountDistinct[list,SameQ]. »
Examples
open allclose allScope (2)
Properties & Relations (3)
CountDistinct[list] is equivalent to CountDistinct[list,SameQ]:
CountDistinct[list] is equivalent to Length[DeleteDuplicates[list]]:
CountDistinct[list,test] is equivalent to Length[DeleteDuplicates[list,test]]:
CountDistinct[list,test] applies test to two elements to determine if they are equivalent:
CountDistinctBy[list,f] applies the transformation f to each element, then compares the results:
Text
Wolfram Research (2014), CountDistinct, Wolfram Language function, https://reference.wolfram.com/language/ref/CountDistinct.html (updated 2024).
CMS
Wolfram Language. 2014. "CountDistinct." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/CountDistinct.html.
APA
Wolfram Language. (2014). CountDistinct. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CountDistinct.html