Re: bitwise or?

2018-10-06 Thread JJ Merelo
El sáb., 6 oct. 2018 a las 1:17, Timo Paulssen () escribió: > Yes, there is an absolutely tiny mention of it on the page: > > Metaoperators > > Metaoperators can be parameterized with other operators or subroutines in > the same way as functions can take functions as parameters. To use a >

Re: bitwise or?

2018-10-05 Thread Timo Paulssen
Yes, there is an absolutely tiny mention of it on the page: Metaoperators Metaoperators can be parameterized with other operators or subroutines in the same way as functions can take functions as parameters. To use a subroutine as a parameter, prefix its name with a &. Perl 6 will generate the

Re: bitwise or?

2018-10-05 Thread Trey Harris
On Fri, Oct 5, 2018 at 8:33 AM Timo Paulssen t...@wakelift.de wrote: It's important to point out that inside metaoperators ("composed > operators", "combined operators", ...) the [ ] are just for bracketing > things together — sometimes it's needed to

Re: bitwise paper?

2018-10-05 Thread ToddAndMargo via perl6-users
On 10/2/18 9:15 PM, David Green wrote: On 2018-10-02 9:57 pm, ToddAndMargo wrote: Does anyone know of a paper out in web land showing how to do bitwise operations? $ p6 'my $v = 32 & 16; say $v;' If you search docs.perl6.org for "bitwise" you will find "+&": htt

Re: bitwise paper?

2018-10-05 Thread David Green
On 2018-10-02 9:57 pm, ToddAndMargo wrote: Does anyone know of a paper out in web land showing how to do bitwise operations? Trying to AND 0010 with 0001 $ p6 'my $v = 32 & 16; say $v;' If you search docs.perl6.org for "bitwise" you will find "+&": htt

Re: bitwise paper?

2018-10-05 Thread David Green
On 2018-10-02 9:57 pm, ToddAndMargo wrote: Does anyone know of a paper out in web land showing how to do bitwise operations? $ p6 'my $v = 32 & 16; say $v;' If you search docs.perl6.org for "bitwise" you will find "+&": https://docs.perl6.org/language/operators#inf

Re: bitwise or?

2018-10-05 Thread Timo Paulssen
It's important to point out that inside metaoperators ("composed operators", "combined operators", ...) the [ ] are just for bracketing things together — sometimes it's needed to disambiguate, but you can put it in anyway to make things clearer. This has nothing to do with [+] 1, 2, 3, which is a

Re: bitwise or?

2018-10-05 Thread Brad Gilbert
Note that = is actually a meta operator that can take an infix operator as an argument So $a += 1 is really short for $a [+]= 1 On Fri, Oct 5, 2018 at 1:02 AM Todd Chester wrote: > > > > On 10/4/18 12:13 PM, Brandon Allbery wrote: > > It's fine syntactically, but I think has no

Re: bitwise or?

2018-10-05 Thread Todd Chester
On 10/4/18 12:13 PM, Brandon Allbery wrote: It's fine syntactically, but I think has no effect because it'd be '$v = $v' after the '+|='. Conceivably some future version of rakudo could warn about it having no effect. That explains it. Thank you!

Re: bitwise or?

2018-10-04 Thread Brandon Allbery
It's fine syntactically, but I think has no effect because it'd be '$v = $v' after the '+|='. Conceivably some future version of rakudo could warn about it having no effect. On Thu, Oct 4, 2018 at 3:09 PM ToddAndMargo wrote: > On 10/4/18 12:06 PM, ToddAndMargo wrote: > > On 10/4/18 12:00 PM, JJ

Re: bitwise or?

2018-10-04 Thread ToddAndMargo
On 10/4/18 12:00 PM, JJ Merelo wrote: El jue., 4 oct. 2018 a las 20:58, ToddAndMargo (>) escribió: Hi All, I am trying to come up with something like +=       $ p6 'my $v = 32; $v += 2; say $v;'       34 to replace       $ p6 'my

Re: bitwise or?

2018-10-04 Thread ToddAndMargo
On 10/4/18 12:06 PM, ToddAndMargo wrote: On 10/4/18 12:00 PM, JJ Merelo wrote: El jue., 4 oct. 2018 a las 20:58, ToddAndMargo (>) escribió:     Hi All,     I am trying to come up with something like +=       $ p6 'my $v = 32; $v += 2; say $v;'      

Re: bitwise or?

2018-10-04 Thread ToddAndMargo
On 10/4/18 12:00 PM, Brandon Allbery wrote: You're not doing anything with '$v +| 0b0001'. Were you looking for something like '+|='? (Which I think should work.) On Thu, Oct 4, 2018 at 2:58 PM ToddAndMargo > wrote: Hi All, I am trying to come up

Re: bitwise or?

2018-10-04 Thread Brandon Allbery
You're not doing anything with '$v +| 0b0001'. Were you looking for something like '+|='? (Which I think should work.) On Thu, Oct 4, 2018 at 2:58 PM ToddAndMargo wrote: > Hi All, > > I am trying to come up with something like += > > $ p6 'my $v = 32; $v += 2; say $v;' > 34 > >

Re: bitwise or?

2018-10-04 Thread JJ Merelo
El jue., 4 oct. 2018 a las 20:58, ToddAndMargo () escribió: > Hi All, > > I am trying to come up with something like += > > $ p6 'my $v = 32; $v += 2; say $v;' > 34 > > to replace > > $ p6 'my $v = 0b0010; $v = $v +| 0b0001; say $v;' > 48 > > > But I obviously have

bitwise or?

2018-10-04 Thread ToddAndMargo
Hi All, I am trying to come up with something like += $ p6 'my $v = 32; $v += 2; say $v;' 34 to replace $ p6 'my $v = 0b0010; $v = $v +| 0b0001; say $v;' 48 But I obviously have something wrong: $ p6 'my $v = 0b0010; $v +| 0b0001; say $v;'

Re: bitwise paper?

2018-10-04 Thread ToddAndMargo
On 10/4/18 10:01 AM, ToddAndMargo wrote: On 10/3/18 7:16 PM, ToddAndMargo wrote: 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;'

Re: bitwise paper?

2018-10-04 Thread ToddAndMargo
On 10/3/18 7:16 PM, ToddAndMargo wrote: 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

Re: bitwise paper?

2018-10-03 Thread ToddAndMargo
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. Hi Trey, Ah poop! I m

Re: bitwise paper?

2018-10-03 Thread Trey Harris
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

Re: bitwise paper?

2018-10-03 Thread ToddAndMargo
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;

Re: bitwise paper?

2018-10-03 Thread ToddAndMargo
> I'm looking at > https://docs.perl6.org/language/operators#index-entry-Numeric_bitwise_AND_operator > right now and it has entries for every bitwise operator. I suggest you > hold down the SHIFT key and press reload to clear your browser cache. > > > > But, now

Re: bitwise paper?

2018-10-03 Thread Trey Harris
On Wed, Oct 3, 2018 at 20:56 ToddAndMargo wrote: > On 10/3/18 1:50 PM, Trey Harris wrote: > > > > On Wed, Oct 3, 2018 at 13:38 ToddAndMargo > <mailto:toddandma...@zoho.com>> wrote: > > > > > Go to docs.perl6.org <http://docs.perl6.org>

Re: bitwise paper?

2018-10-03 Thread ToddAndMargo
On 10/3/18 1:50 PM, Trey Harris wrote: On Wed, Oct 3, 2018 at 13:38 ToddAndMargo <mailto:toddandma...@zoho.com>> wrote: > Go to docs.perl6.org <http://docs.perl6.org> <http://docs.perl6.org>. Type "bitwise" into the > search box. Y

Re: bitwise paper?

2018-10-03 Thread Trey Harris
On Wed, Oct 3, 2018 at 13:38 ToddAndMargo wrote: > > Go to docs.perl6.org <http://docs.perl6.org>. Type "bitwise" into the > > search box. You will see a popup, "Numeric bitwise AND operator". Click > > it to be taken to > > >

Re: bitwise paper?

2018-10-03 Thread ToddAndMargo
On 10/2/18 9:46 PM, Trey Harris wrote: On Tue, Oct 2, 2018 at 23:57 ToddAndMargo <mailto:toddandma...@zoho.com>> wrote: Hi All, Does anyone know of a paper out in web land showing how to do bitwise operations?  DuckDuckGo give me tons of hits for Perl 5.

Re: bitwise paper?

2018-10-03 Thread ToddAndMargo
On 10/2/18 10:16 PM, David Green wrote: On 2018-10-02 9:57 pm, ToddAndMargo wrote: Does anyone know of a paper out in web land showing how to do bitwise operations? Trying to AND 0010 with 0001 $ p6 'my $v = 32 & 16; say $v;' If you search docs.perl6.org for "bitwise"

Re: bitwise paper?

2018-10-02 Thread David Green
On 2018-10-02 9:57 pm, ToddAndMargo wrote: Does anyone know of a paper out in web land showing how to do bitwise operations? Trying to AND 0010 with 0001 $ p6 'my $v = 32 & 16; say $v;' If you search docs.perl6.org for "bitwise" you will find "+&": htt

Re: bitwise paper?

2018-10-02 Thread Trey Harris
On Tue, Oct 2, 2018 at 23:57 ToddAndMargo wrote: > Hi All, > > Does anyone know of a paper out in web land showing how to > do bitwise operations? DuckDuckGo give me tons of hits > for Perl 5. > > Trying to AND 0010 with 0001 > > $ p6 'my $v = 32

bitwise paper?

2018-10-02 Thread ToddAndMargo
Hi All, Does anyone know of a paper out in web land showing how to do bitwise operations? DuckDuckGo give me tons of hits for Perl 5. Trying to AND 0010 with 0001 $ p6 'my $v = 32 & 16; say $v;' all(32, 16) should give me . I have a nice paper on Perl 5. I don't t