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).
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
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 }
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
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
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
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
I was playing with a regex and array interpolation.
From the documentation I thought the following comparisons would be the
same, but they are not.
What am I missing?
my @W = ;
my $S = 'perlchallengeextrathingswithweeklysome' ; #randomly concatenate the words
without spaces say 'yes' if $S ~
> Am 17.04.2015 um 04:34 schrieb Nathan Gray:
> > # Call it if it is a routine. This will capture if requested.
> > return (var)(self) if nqp::istype(var,Callable);
> >
> > This seems to indicate that captures in the embedded regexes
> > should capture.
On Fri, Apr 17, 2015 at 09:47:22AM +0200
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
The comment in INTERPOLATE is about "subcaptures"... but if you do not
capture the interpolated regex itself, you break that chain.
Am 17.04.2015 um 04:34 schrieb Nathan Gray:
> On Wed, Apr 15, 2015 at 09:45:39PM -0400, Nathan Gray wrote:
>> I had g
On Wed, Apr 15, 2015 at 09:45:39PM -0400, Nathan Gray wrote:
> I had given up on using regexes embedded within regexes, because
> I could not get capturing to work.
I did a backtrace on one of the test cases that fails, which led
me to
src/core/Cursor.pm
in
method INTERPOLATE(\var, $i = 0,
On Tue, Apr 14, 2015 at 08:58:29PM -0500, Patrick R. Michaud wrote:
> Just an idea: instead of building strings to be interpolated into
> a regex, could you just build regexes directly?
>
> my $pattern = rx/$=[hello]/;
> my $match = "hello" ~~ / /;
>
> The resulting string is captured i
second statement can also be written as:
# captures into $match
my $match = "hello" ~~ / $=$pattern /;
# captures into $match[0]
my $match = "hello" ~~ / $<0>=$pattern /;
Hope this is useful, or at least illustrative.
> Of course, there may b
"/";
Of course, there may be a better way, since regex interpolation
seems frowned upon in Perl 6.
One idea I have is to generate a grammar, but the only way I've
been able to get that to work is to create a string that looks
like a grammar, and EVAL it. Is that a Perl 6 be
Biggar
--
m...@biggar.org
mark.a.big...@comcast.net
mbig...@paypal.com
- Original Message -
From: Mark J. Reed
To: perl6-langu...@perl.org
Sent: Mon, 29 Mar 2010 14:27:00 +0000 (UTC)
Subject: Regex interpolation
Is there not a way to run arbitrary code and interpolate the result as
a literal string
Is there not a way to run arbitrary code and interpolate the result as
a literal string (instead of a Regex)?
I assume that {...} is intended to be where you hook in
semantics/actions mid-parse, but it seems a bit counter-intuitive that
the same syntax interpolates in double-quote context but not
16 matches
Mail list logo