Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Perform the complement operation on multisets
ResourceFunction["MultisetComplement"][listall,list1,list2,…] gives the elements in listall that are in excess of those in all the listi. | |
ResourceFunction["MultisetComplement"][assocall,assoc1,assoc2,…] gives an Association where the keys are the union of the keys in the associations assocall and associ, and the values are the greater of the difference of the values in assocall and the sum of the values in the associ and 0. |
Find which elements in the first list are not in any of the subsequent lists:
In[1]:= |
Out[1]= |
Multisets as Association of counts:
In[2]:= |
Out[2]= |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License