On Wed, May 04, 2005 at 07:29:35AM -0700, Mark A. Biggar wrote: > Except that xor or ^^ is only a binary operation, there is no > "xor(p1,p2,...)", only "p1 xor p2 xor ..." which can really only be > understood if you add () to disambiguate the order that the binary ops > are performed. Fortunately, xor is associative so it doesn't matter how > you add the (), you get the same answer. Try it out, you will discover > that "p1 xor p2 xor ..." is true iff an odd number of the p's are true.
Be careful here, although C<xor> is indeed a binary op, that doesn't make it a boolean one. In particular, C<xor> is NOT associative: print ( ("a" xor "b") xor "c"); # outputs "c" print ( "a" xor ("b" xor "c")); # outputs "a" We might get the "select one value" interpretation of C<xor> if xor is defined as a chained operator of some sort, but that's really up to the perl6-language folks to decide (and any folloups on that topic should go there). Pm