That's a convincing argument. One misght still want a way to delete selected elements completely. Something like a = a & ~(<1,2>) to delete all 1s and 2s.
/ Niels Möller ()
Previous text:
2003-02-06 13:09: Subject: Xor
Yes, I agree on that. Those operators make sense.
`^ uses PIKE_ARRAY_OP_XOR which is "PIKE_MINTERM(PIKE_ARRAY_OP_TAKE_A,PIKE_ARRAY_OP_SKIP_A | PIKE_ARRAY_OP_SKIP_B,PIKE_ARRAY_OP_TAKE_B)", (PIKE_MINTERM defining a bitfield), which I can't see that clearly what it does.
`- on multisets ought to fill these criteria, I think: (a+b)-b == a a^b=(a-b)+(b-a)
And since `+ makes sense, `- ought to remove one element for every matching element in the multiset. Then the current behaviour of `^ makes sense:
(<1,1,1,2,2,3>)^(<1,3>);
(5) Result: (< 1, 1, 2, 2 >)
where (<1,1,1,2,2,3>)^(<1,3>) == (<1,1,2,2>)+(<>).
/ Mirar