On Fri, Jan 17, 2020 at 11:03 PM ToddAndMargo via perl6-users <perl6-us...@perl.org <mailto:perl6-us...@perl.org>> wrote:

    Hi All,

    https://docs.raku.org/routine/+$CIRCUMFLEX_ACCENT

    (Operators) infix +^ยง

    multi sub infix:<+^>($a, $b --> Int:D)

    Integer bitwise XOR operator: Coerces both arguments to Int and does a
    bitwise XOR (exclusive OR) operation.


    $ p6 'my uint8 $x=0b0101_0111; my uint8 $y = 0b0000_1111; my uint8 $z =
    +^($x, $y ); say "0", $x.base(2); say "0000", $y.base(2); say
    $z.base(2);'

    01010111
    00001111
    11111101


    XOR
    A  B   A xor B
    0  0      0
    1  0      1
    0  1      1
    1  1      0

    That s not what I am seeing above.

    What am I doing wrong this time?

    And who set the high bit making $z negative?

    Many thanks,
    -T


On 2020-01-17 20:24, Paul Procacci wrote:
multi sub infix:<+^>($a, $b-->Int:D)


_infix_ here is the keyword for you.

my uint8 $z = $x +^ $y;

$ p6 'my uint8 $x=0b0101_0111; my uint8 $y = 0b0000_1111; my uint8 $z = $x +^ $y; say "0", $x.base(2); say "0000", $y.base(2); say z.base(2);'
===SORRY!=== Error while compiling -e
Undeclared routine:
    z used at line 1

What does "sub" stand for?

Reply via email to