Re: regex interpolation of array

2020-06-13 Thread William Michels via perl6-users
Thank you so much for explaining what's going on here, Brad. You gave a good example--just one that I misinterpreted. I think I understand now: inside a regex Richard has to enclose his code within "<{ ... }>" for it to be properly interpreted as a 'match objective' (I hope I said that correctly).

Re: regex interpolation of array

2020-06-13 Thread Brad Gilbert
On Sat, Jun 13, 2020 at 1:27 PM Sean McAfee wrote: > On Sat, Jun 13, 2020 at 10:21 AM Brad Gilbert wrote: > >> That was just a dumb example. >> An incredibly dumb example. >> >> So what happens is that `Bool.pick` chooses The Bool values of either >> `True` or `False`. >> It does this at every p

Re: regex interpolation of array

2020-06-13 Thread Sean McAfee
On Sat, Jun 13, 2020 at 10:21 AM Brad Gilbert wrote: > That was just a dumb example. > An incredibly dumb example. > > So what happens is that `Bool.pick` chooses The Bool values of either > `True` or `False`. > It does this at every position in the string. > > 'TrueFalse' ~~ / <{ Bool.pick }

Re: regex interpolation of array

2020-06-13 Thread Brad Gilbert
That was just a dumb example. An incredibly dumb example. So what happens is that `Bool.pick` chooses The Bool values of either `True` or `False`. It does this at every position in the string. 'TrueFalse' ~~ / <{ Bool.pick }> Let's say that initially `Bool.pick` chooses `False`. That value t

Re: regex interpolation of array

2020-06-13 Thread William Michels via perl6-users
Hi, I seem to be having some problems with Brad's code. The 'boolean pick' code seems far too clever for me to have intuited it on my own, so (to expand my Raku/Perl6 vocabulary), I played around with matching extra 'True' or 'False' values--as well as played around with seeing if similar 'boolean

Re: regex interpolation of array

2020-06-13 Thread Richard Hainsworth
Understood. Thankyou. The " quotes is what I missed. So $ = "@W[3]" worked as I would expect. The other two variations, eg. $ =<{ @W[3] }>, gave Nil responses, indicating match failure. On 13/06/2020 14:41, Brad Gilbert wrote: Inside of a regex `{…}` will just run some regular Raku code. Cod

Re: regex interpolation of array

2020-06-13 Thread Brad Gilbert
Inside of a regex `{…}` will just run some regular Raku code. Code inside of it will most likely have no effect on what the regex matches. What you should have written was: $ = "@W[3]" The thing you were thinking of was: $ = <{ @W[3] }> Which could have been written as: --- To