Re: Need match character help

2018-05-20 Thread ToddAndMargo

On 05/20/2018 04:16 PM, yary wrote:
PRM's suggestion was "/inverting the entire regex -- i.e., instead of 
matching finding things that do match, exclude the things that don't ... 
use !~~ or some similar logic to get the strings wanted/" which IMO is 
an excellent idea. Your implementation didn't take the inversion into 
account- try this


p6 'if "hgm" *!~~* / gm | <-[d..z]> / {say "y"} else {say "n"}'




p6 'if "hgm" !~~ / gm | <-[d..z]> / {say "y"} else {say "n"}'
n

$ p6 'if "cgm" !~~ / gm | <-[d..z]> / {say "y"} else {say "n"}'
n

$ p6 'if "zgm" !~~ / gm | <-[d..z]> / {say "y"} else {say "n"}'
n

$ p6 'if "z" !~~ / gm | <-[d..z]> / {say "y"} else {say "n"}'
y


Thank you!


Re: Need match character help

2018-05-20 Thread yary
PRM's suggestion was "*inverting the entire regex -- i.e., instead of
matching finding things that do match, exclude the things that don't ...
use !~~ or some similar logic to get the strings wanted*" which IMO is an
excellent idea. Your implementation didn't take the inversion into account-
try this

p6 'if "hgm" *!~~* / gm | <-[d..z]> / {say "y"} else {say "n"}'


Re: Need match character help

2018-05-20 Thread ToddAndMargo

On 05/20/2018 03:14 PM, Patrick R. Michaud wrote:

On Sun, May 20, 2018 at 03:02:34PM -0700, ToddAndMargo wrote:

On 05/20/2018 10:40 AM, Patrick R. Michaud wrote:

On Fri, May 18, 2018 at 03:28:20PM +0200, Timo Paulssen wrote:

On 18/05/18 13:30, The Sidhekin wrote:


    / ^ <[d..z]>* $/


That's pretty good! Putting the beginning-of-string anchor ^ anywhere
but the very start is surely an advanced move :)


FWIW, sometimes I think it's worth inverting the entire regex -- i.e., instead 
of matching finding things that do match, exclude the things that don't:

 / gm | <-[d..z]> /

This regex will match any string containing the sequence "gm" or any character that isn't in the range 
"d".."z", which is the inverse of what was required (strings containing only "d".."z" and never 
"gm").  Then use !~~ or some similar logic to get the strings wanted.

I recognize that this approach might not fit well in all cases, but it's 
another (perhaps cleaner) approach to getting what's wanted.


Something is wrong.  "h" is in the exclude list.

$ p6 'if "hgm" ~~ / gm | <-[d..z]> / {say "y"} else {say "n"}'
y


The string "hgm" is in the "not include" list for the other regex as well (because it 
contains "gm"):

$ perl6 -e 'if "hgm" ~~ /  ^ <[d..z]>* $/ { say "n" } else { say 
"y" }'
y


Pm




Me still scratching me head

--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


Re: Need match character help

2018-05-20 Thread Patrick R. Michaud
On Sun, May 20, 2018 at 03:02:34PM -0700, ToddAndMargo wrote:
> On 05/20/2018 10:40 AM, Patrick R. Michaud wrote:
> > On Fri, May 18, 2018 at 03:28:20PM +0200, Timo Paulssen wrote:
> > > On 18/05/18 13:30, The Sidhekin wrote:
> > > > 
> > > >    / ^ <[d..z]>* $/
> > > 
> > > That's pretty good! Putting the beginning-of-string anchor ^ anywhere
> > > but the very start is surely an advanced move :)
> > 
> > FWIW, sometimes I think it's worth inverting the entire regex -- i.e., 
> > instead of matching finding things that do match, exclude the things that 
> > don't:
> > 
> > / gm | <-[d..z]> /
> > 
> > This regex will match any string containing the sequence "gm" or any 
> > character that isn't in the range "d".."z", which is the inverse of what 
> > was required (strings containing only "d".."z" and never "gm").  Then use 
> > !~~ or some similar logic to get the strings wanted.
> > 
> > I recognize that this approach might not fit well in all cases, but it's 
> > another (perhaps cleaner) approach to getting what's wanted.
> 
> Something is wrong.  "h" is in the exclude list.
> 
> $ p6 'if "hgm" ~~ / gm | <-[d..z]> / {say "y"} else {say "n"}'
> y

The string "hgm" is in the "not include" list for the other regex as well 
(because it contains "gm"):

$ perl6 -e 'if "hgm" ~~ /  ^ <[d..z]>* $/ { say "n" } else { say 
"y" }'
y


Pm


Re: Need match character help

2018-05-20 Thread ToddAndMargo

On 05/20/2018 10:40 AM, Patrick R. Michaud wrote:

On Fri, May 18, 2018 at 03:28:20PM +0200, Timo Paulssen wrote:

On 18/05/18 13:30, The Sidhekin wrote:


   / ^ <[d..z]>* $/


That's pretty good! Putting the beginning-of-string anchor ^ anywhere
but the very start is surely an advanced move :)


FWIW, sometimes I think it's worth inverting the entire regex -- i.e., instead 
of matching finding things that do match, exclude the things that don't:

/ gm | <-[d..z]> /

This regex will match any string containing the sequence "gm" or any character that isn't in the range 
"d".."z", which is the inverse of what was required (strings containing only "d".."z" and never 
"gm").  Then use !~~ or some similar logic to get the strings wanted.

I recognize that this approach might not fit well in all cases, but it's 
another (perhaps cleaner) approach to getting what's wanted.

Pm





Something is wrong.  "h" is in the exclude list.

$ p6 'if "hgm" ~~ / gm | <-[d..z]> / {say "y"} else {say "n"}'
y





--
~~
Computers are like air conditioners.
They malfunction when you open windows
~~


[perl #130774] [BUG] Rational.REDUCE-ME has a data race

2018-05-20 Thread Zoffix Znet via RT
Data race is now fixed (in a post release branch):

Rakudo fix: 
https://github.com/rakudo/rakudo/commit/6dd20588b6dfb75a121e2207df5f8c89aad3e1ef
Test: https://github.com/perl6/roast/commit/1d10e9dc12


[perl #130774] [BUG] Rational.REDUCE-ME has a data race

2018-05-20 Thread Zoffix Znet via RT
Data race is now fixed (in a post release branch):

Rakudo fix: 
https://github.com/rakudo/rakudo/commit/6dd20588b6dfb75a121e2207df5f8c89aad3e1ef
Test: https://github.com/perl6/roast/commit/1d10e9dc12


Re: Need match character help

2018-05-20 Thread Patrick R. Michaud
On Fri, May 18, 2018 at 03:28:20PM +0200, Timo Paulssen wrote:
> On 18/05/18 13:30, The Sidhekin wrote:
> >
> >   / ^ <[d..z]>* $/
> 
> That's pretty good! Putting the beginning-of-string anchor ^ anywhere
> but the very start is surely an advanced move :)

FWIW, sometimes I think it's worth inverting the entire regex -- i.e., instead 
of matching finding things that do match, exclude the things that don't:

   / gm | <-[d..z]> /

This regex will match any string containing the sequence "gm" or any character 
that isn't in the range "d".."z", which is the inverse of what was required 
(strings containing only "d".."z" and never "gm").  Then use !~~ or some 
similar logic to get the strings wanted.

I recognize that this approach might not fit well in all cases, but it's 
another (perhaps cleaner) approach to getting what's wanted.

Pm