Todd,

Assuming you are suggesting your examples are showing differences between
the languages, in all your examples of differences between Perl 6 and Perl
5 below, you are using the wrong operator or you changed one of the
arguments between the Perl 5 and Perl 6 examples.

I won't go through them each, but for example '> 3' is the greater-than
operator in Perl 5; 0b0001_0100 (20) is greater than 3, so the answer is 1
(true). And in your bitwise shift left, you're shifting by 2 in Perl 6 but
by 3 in Perl 5. And so on.

If you weren't trying to show differences between the languages but had
some other reason for changing multiple controls at once, never mind me; I
don't know how your "keeper file" works.

(But I should point out that since you at least at some point suggested
it's the sort of stuff you'd like to see in the docs, we don't give Perl 5
comparisons in the part of the docs that don't relate to Perl 5 (just in
the Perl 5 to Perl 6 Guide docs and _very_ rarely in a couple of other
cases that represent bad traps for those who might assume something works
like it does in Perl 5), and when we do give side-by-side examples of two
things, authors have tried to give example that change the minimum required
to show the difference and no more.)


On Wed, Oct 3, 2018 at 22:16 ToddAndMargo <toddandma...@zoho.com> wrote:

> My keeper file so far:
>
> Perl: bitwise operators:
>
> alias p5='perl6 -E'
> alias p6='perl6 -e'
>
>
> Bitwise AND:
>      $ p6 'my $v = 32 +& 16; say $v;'
>      0
>
>      $ p5 'my $v = 32 & 16; say $v;'
>      0
>
>
> Bitwise OR:
>      $ p5 'my $v = 32 | 16; say $v;'
>      48
>
>      $ p6 'my $v = 32 +| 16; say $v;'
>      48
>
>
> Bitwise shift left:
>      $ p6 'my $v = 0b00000100 +< 2; say $v;'
>      16
>
>      $ p5 'my $v = 0b00000100 << 3; say $v;'
>      32
>
>
>
> Bitwise shift right:
>      $ p5 'my $v = 0b00010100 > 3; say $v;'
>      1
>
>      $ p6 'my $v = 0b00110100 +> 3; say $v;'
>      6
>
>
> Bitwise XOR:
>      $ p5 'my $v = 0b00101101 ^ 0b00001001; say $v;'
>      36
>
>      $ p6 'my $v = 0b00001101 +^ 0b00001001; say $v;'
>      4
>
>
> Bitwise Compliment (flip the bits):
>      $ p5 'my $x = 0b00101101; my $y= (~$x); my $z= (~$y); say
> "$x\n$y\n$z"; '
>      45
>      18446744073709551570
>      45
>
>      $ p6 'my $x = 0b00101101; my $y= (+^$x); my $z= (+^$y); say
> "$x\n$y\n$z"; '
>      45
>      -46
>      45
>
>
> Bitwise "IN" (Does y exist in x):
>
>      $ p6 'my $x=0b1001; my $y=0b0101; my $z=$x +& $y; say so $y == $z;'
>      False
>
>      $ p6 'my $x=0b1001; my $y=0b1001; my $z=$x +& $y; say so $y == $z;'
>      True
>
>      p5 not figured out yet
>

Reply via email to