Hi, I have cats, fish and dogs.
In[173]:= animals = {cat, dog , fish, dog, cat}
Out[173]= {cat, dog, fish, dog, cat}
I want to take out the fish.
In[174]:= Complement[animals, {fish}]
Out[174]= {cat, dog}
Unfortunately Mathamatica killed one of my cat and one of my dog. I want a result that looks like:
Out[173]= {cat, dog, dog, cat}
or if Mathematica really wants to sort it, then:
Out[173]= {cat, cat, dog, dog}
How can I do it and make it fast?
Thanks ahead, János
P.S. The documentation says only that the result is sorted.
The list returned by Complement is sorted into standard order.
Well, it is not.
In[175]:= Sort[animals]
Out[175]= {cat, cat, dog, dog, fish}
Sort does not eliminate duplicates. Complement is Union-ized. Very bad for my purpose.