Damian Conway wrote:

Perl 6's approach to xor is consistent with the linguistic sense of 'xor' ("You may have a soup (x)or a salad (x)or a cocktail"), and also with the IEEE 91 standard for logic gates. See:http://ozark.hendrix.edu/~burch/logisim/docs/2.1.0/libs/gates/xor.html for a concise explanation of both these senses of xor.

`I think that, where such a definition makes sense, any N-adic operation in Perl`

`6 that would often be defined as a reduction operator / a repetition of dyadic`

`operations should have those semantics, and any other behaviors shouldn't be the`

`default, but be given some other less ambiguous name if useful.`

`And so, an N-adic xor should result in true (or one of its true operands) iff an`

`odd number of its inputs is true. And also, this operator can't short-circuit.`

`However, it could be reasonably assumed that either the first or the last true`

`operand is what is always returned when any is returned; as for which one, I`

`suggest using the same semantics as 'or', meaning the first, since 'xor' is a`

`lot like 'or' in other ways such as its identity value.`

`If you want an N-adic operator that results in true (or its true operand) iff`

`exactly one of its inputs is true, then that should be called something else. I`

`suggest calling it one(), or if that's confusing due to some junction operator,`

`then maybe single() or something else.`

`In fact I would argue it is useful to have both operators, one that's true for`

`an odd number of true inputs, and one that's true for exactly one true input.`

`If the name 'xor' is so touchy, then maybe don't use that name at all, and just`

`use say 'odd' and 'one' etc. On a tangent, maybe an 'even' operator would be`

`useful too. This said, assuming you're going for 2 versions of everything, one`

`high and one low precedence, I have no opinion as to whether ^^ goes to 'odd' or`

`'one', since AFAIK that isn't a standard symbol for the op from math anyway.`

-- Darren Duncan