On Wed, Apr 13, 2005 at 07:15:48AM -0400, John Macdonald wrote:
> On Tuesday 12 April 2005 23:46, Patrick R. Michaud wrote:
> > No, I'm afraid I haven't messed up my math.  Integer-xor is &infix:<+^> .
> > Array-of-bits-xor is &infix:<~^> .  I'm specifically talking about 
> > &infix:<xor>, which "Perl 6 and Parrot Essentials" says (p. 36):
> 
> Time for me to see the optometrist.
> 
> I could have sworn that your examples were returning 0 and 2, but
> that's definitely a 6 up there.  We're violently in agreement.  The
> "boolean" form of xor is associative about the true/false meaning
> of what it returns, but non-associative about what actual value is
> returned for true.
> 
> I apologize.  You were not mixed up or messed up.

Thanks, I can see it was an honest error.  I've done the same.  :-)

For clarity in future discussions, I'd suggest that we bear in
mind that perl 6 makes a distinction between "boolean xor" and 
"logical xor".  "Boolean xor" is officially &infix:<?^>, and 
returns a true/false value based on the truth/falsity of its 
arguments.  "Logical xor" is &infix:<^^> (tight) or 
&infix:<xor> (loose), and returns false if both arguments are true, 
false if both arguments are false, or its non-false argument.

For completeness, from S03:

                   and            or            xor          not
boolean         &infix:<?&>   &infix:<?|>   &infix:<?^>  &prefix:<!>
integer         &infix:<+&>   &infix:<+|>   &infix:<+^>  &prefix:<+^>
string          &infix:<~&>   &infix:<~|>   &infix:<~^>  &prefix:<~^>
logical tight   &infix:<&&>   &infix:<||>   &infix:<^^>  
logical loose   &infix:<and>  &infix:<or>   &infix:<xor> &prefix:<not>

Pm

Reply via email to