I’ve some difficulties with lists containing products as elements, e.g. list = {ABA, AKB, AKR}
, where A and B are from the same ‘family’, let’s call it sector 1, while K and R are from sector 2.
I would like to find a way to sort the list
according to the occurrence of elements from sector 2.
The desired output should be something like
listWith0Sector2elements = {AKB}
listWith1Sector2elements = {AKB}
listWith2Sector2elements = {AKR}
my naive attempt (Count
, MemberQ
…) unfortunately failed, as I have never had anything to do with products