Depends on what `- is used for. I guess the common use is to clear out all elements.
Having (<1,1,2>) - (<1>) = (<1,2>) would be kind of nice, but then one would need some other operation for deleteing all the ones. m - (<1,1,1,1,1,1,1,1,1>) or m - sizeof(m) * (<1>) isn't particularly pretty.
BTW, why doesn't int * multiset work?
/ Niels Möller ()
Previous text:
2003-02-05 16:33: Subject: Xor
If that is correct, wouldn't
(<1,1,2>) - (<1>) = (<1,2>)
Let #X denote the number of occurances of a given element in X, then it makes sense to have
#(A ^ B) == #A + #B (mod 2)
( #A + #B ) mod 2, you mean? I think can agree to that. However, that would mean that (<1,1>)^(<2,2>) = (<>), and (<1,1,1>)^(<>) = (<1>), which might be confusing.
I just think that a^b should equal (a-b)+(b-a). If a-b removes one element in a per element in b (fixing - instead of ^), this becomes true with the above behaviour (again). Possibly could multisets and arrays behave differently here, arrays removing all matching while multisets remove one element for each matching element.
/ Mirar