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
Previous text:
2003-02-05 15:29: Subject: Xor
For multisets, I'd say that the current behaviour is correct,
(<1,1,2>) ^ (<1>);
(2) Result: (< /* 2 elements */ 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)
just like above. But I don't know whether or not it's desirable to have arrays behave as multisets for this operation.
/ Niels Möller ()