Re: What's going on with "given (junction) {when (value)...}"

2021-06-04 Thread Ralph Mellor
On Wed, Jun 2, 2021 at 11:57 AM William Michels wrote: > > Hi Ralph, Both prefix/postfix 'when' look okay on my Rakudo_2020.10 install: Only postfix in 2021.03: https://replit.com/@RalphMellor/FooACCEPT-junction#main.raku

Re: What's going on with "given (junction) {when (value)...}"

2021-06-02 Thread William Michels via perl6-users
Hi Ralph, Both prefix/postfix 'when' look okay on my Rakudo_2020.10 install: user@mbook:~$ raku Welcome to 퐑퐚퐤퐮퐝퐨™ v2020.10. Implementing the 퐑퐚퐤퐮™ programming language v6.d. Built on MoarVM version 2020.10. To exit type 'exit' or '^D' > when 3 { say 'prefix when' } False > { say 'postfix when'

Re: What's going on with "given (junction) {when (value)...}"

2021-06-01 Thread Tom Browder
On Tue, Jun 1, 2021 at 11:31 William Michels via perl6-users < perl6-users@perl.org> wrote: > Hi Bruce, > This is what I see with Rakudo 2020.10 (all code below performs > delightfully as expected): > This whole thread looks like good stuff for some probably missing roast tests. -Tom

Re: What's going on with "given (junction) {when (value)...}"

2021-06-01 Thread William Michels via perl6-users
Hi Bruce, This is what I see with Rakudo 2020.10 (all code below performs delightfully as expected): user@mbook:~$ raku Welcome to 퐑퐚퐤퐮퐝퐨™ v2020.10. Implementing the 퐑퐚퐤퐮™ programming language v6.d. Built on MoarVM version 2020.10. To exit type 'exit' or '^D' > ? (any(4,3) ~~ 3) True > ? (3 ~~

Re: What's going on with "given (junction) {when (value)...}"

2021-06-01 Thread Ralph Mellor
Curiously, it works for postfix `when`: ``` $_ := any(4,3); {say 'postfix when'} when 3; # 3 when 3 { say 'prefix when' } # (no output) ``` -- love, raiph

Re: What's going on with "given (junction) {when (value)...}"

2021-06-01 Thread Ralph Mellor
On Tue, Jun 1, 2021 at 4:02 AM Larry Wall wrote: > > In my opinion, the most consistent approach is to disallow any > autothreading of the argument to .ACCEPTS That sounds like a really appropriate simplification as I write this. > All those other smartmatches are sugar for .ACCEPTS, and >

Re: What's going on with "given (junction) {when (value)...}"

2021-05-31 Thread Larry Wall
In my opinion, the most consistent approach is to disallow any autothreading of the argument to .ACCEPTS, such that 3.ACCEPTS(any(3,4)) simply returns False. I suspect the only thing that returns True for that sort of argument is Junction.ACCEPTS(any(3,4)) and such. And we can't autothread that,

Re: What's going on with "given (junction) {when (value)...}"

2021-05-31 Thread yary
Thanks for the explanation, I think the docs (and Roast) also can be more explicit on the difference between $left ~~ $right and $right.ACCEPTS($left) and given ($left) { when $right { ... } } and ... when $right; ralph-if you are reading this, last week you went into detail about

Re: What's going on with "given (junction) {when (value)...}"

2021-05-31 Thread Larry Wall
On Sun, May 30, 2021 at 10:18:13PM -0400, yary wrote: : This came up in today's Raku study group (my own golfing-) : : > ? (any(4,3) ~~ 3) : True : > ? (3 ~~ any(4,3)) : True : > given any(4,3) { when 3 {say '3'}; say 'nope'} : nope : > given 3 { when any(4,3) {say '3'}; say 'nope'} : 3 : > given

Re: What's going on with "given (junction) {when (value)...}"

2021-05-31 Thread yary
Nice checking! I opened https://github.com/rakudo/rakudo/issues/4386 -y On Mon, May 31, 2021 at 3:45 AM Bruce Gray wrote: > > > > On May 30, 2021, at 9:18 PM, yary wrote: > > > > This came up in today's Raku study group (my own golfing-) > > > > > ? (any(4,3) ~~ 3) > > True > > > ? (3 ~~

Re: What's going on with "given (junction) {when (value)...}"

2021-05-31 Thread Bruce Gray
> On May 30, 2021, at 9:18 PM, yary wrote: > > This came up in today's Raku study group (my own golfing-) > > > ? (any(4,3) ~~ 3) > True > > ? (3 ~~ any(4,3)) > True > > given any(4,3) { when 3 {say '3'}; say 'nope'} > nope > > given 3 { when any(4,3) {say '3'}; say 'nope'} > 3 > > given

What's going on with "given (junction) {when (value)...}"

2021-05-30 Thread yary
This came up in today's Raku study group (my own golfing-) > ? (any(4,3) ~~ 3) True > ? (3 ~~ any(4,3)) True > given any(4,3) { when 3 {say '3'}; say 'nope'} nope > given 3 { when any(4,3) {say '3'}; say 'nope'} 3 > given any(4,3) { say .raku } any(4, 3) why does Raku say 'nope' for the example