On Tue, Apr 12, 2005 at 09:15:13PM -0400, John Macdonald wrote: > On Tuesday 12 April 2005 20:45, Darren Duncan wrote: > > At 8:27 PM -0400 4/12/05, John Macdonald wrote: > > >The mathematical definition of xor for two arguments is "true if > > >exactly one argument is true, false otherwise". > > > > Yes. > > > > >When that gets > > >generalized to multiple arguments it means "true if an odd number > > >of the arguments are true, false otherwise". > > > > Is this the official mathematics position? > > It's simply chaining a series of 2-arg xor's together. As it happens, the > result of such chaining comes out as "odd number true" and has the nice > properties of being commutative [a xor b === b xor a] and associative > [((a xor b) xor c) === (a xor (b xor c))].
It's entirely possible that I have my mathematics messed up here, but C<xor> doesn't seem to me to be entirely associative, at least not as I commonly think of associativity. Consider $x = (((0 xor 2) xor 4) xor 6); # ((a xor b) xor c) == 6 $y = ((0 xor 2) xor (4 xor 6)); # (a xor (b xor c)) == 2 Pm