develooper Front page | perl.perl6.language | Postings from June 2009

Re: XOR does not work that way.

Thread Previous
From:
yary
Date:
June 22, 2009 14:43
Subject:
Re: XOR does not work that way.
Message ID:
75cbfa570906221442h14e45b0cq8ffe204eccc0cdff@mail.gmail.com
I had a bit of a problem when first encountering xor with more than
two operands as well. It made sense after I thought about it
linguistically instead of mathematically. When speaking people often
use a string of "or"s to mean "pick one and only one of these choices,
the the exclusion of all others".

Also I suspect that perl6's linguistic interpretation of "xor" (only
one true item in list) will be more useful to programmers than a
mathematical reductionist interpretation (odd number of true items in
list).

I think a note explaining the reasoning behind perl6's behavior on
exclusive-or with >2 items ought to go in the synopsis, as it's bound
to come up again.

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About