Re: Variable character class

2019-09-01 Thread Simon Proctor
Using a set would be good but it doesn't give you the matching string from the original (which is what I thought was required) otherwise Sets would be my first thought. On Sun, 1 Sep 2019, 17:57 William Michels, wrote: > Hi Yary and Paul and Simon, > > I ran into the same difficulties as Yary

Re: Variable character class

2019-09-01 Thread William Michels via perl6-users
Hi Yary and Paul and Simon, I ran into the same difficulties as Yary with repeated characters, so I tried the .unique method. Then after a while, I realized that problems like this might best be treated as "Set" problems in Perl6. Note the Set Intersection operator "(&)" below: sub

Re: Variable character class

2019-09-01 Thread Simon Proctor
sub contains ( Str $chars, Str $_ ) { m:g/<{$chars.comb}>+/ }; This will return all the sets of matching strings but it is doing runtime evaluation of your character string so it's a bit slow. On Sun, 1 Sep 2019 at 04:59, Paul Procacci wrote: > I'm not entirely sure if this is the correct

Re: Variable character class

2019-09-01 Thread yary
Thanks for the ideas. The core issue I'm probing is runtime construction of character classes, with an eye towards opening a documentation issue, or maybe even an issue against the character class implementation. Simon's workaround m:g/<{$chars.comb}>+/ is interesting, interpolating a list which

Re: [ please ] request for perl machine learning utils development

2019-09-01 Thread Shlomi Fish
Hi, [resending] On Wed, 28 Aug 2019 16:47:10 +0800 Cloud Cache wrote: > Hi Elizabeth, > > Thanks for the encouragement. > I am not good at low level system development, just using the high-level > API from tensorflow/keras etc. > So I hope there should have perl's framework appearing. >

Re: Variable character class

2019-09-01 Thread Joseph Brenner
I was just trying to run Simon Proctor's solution, and I see it working for Yary's first case, but not his more complex one with problem characters like brackets included in the list of characters. I don't really see how to fix it, in part because I'm not that clear on what it's actually doing...

Re: Variable character class

2019-09-01 Thread The Sidhekin
On Mon, Sep 2, 2019 at 1:12 AM Joseph Brenner wrote: > I was just trying to run Simon Proctor's solution, and I see it > working for Yary's first case, but not his more complex one with > problem characters like brackets included in the list of characters. > > I don't really see how to fix it,

Re: Variable character class

2019-09-01 Thread yary
Hi Paul, Neither of those match for me- adapted below #!/usr/bin/env perl6 use v6; sub matching_chars(Str $match, Str $y) { say 'eval = ', $y.match: /<{ "<[$match]>" }>/; say 'direct= ', $y.match: /<[$match]>/; my $rematch := $match; say 'bound = ', $y.match: /<[$rematch]>/;

Re: Variable character class

2019-09-01 Thread William Michels via perl6-users
Thanks Simon, good point. I ran into the same trouble as others trying to get the answer via regex, and switched over to sets as an alternative. I'll confess I completely missed that Yary's Perl5 code returned the substring "8420" present in his test "19584203" string, and that was the answer he

Re: Variable character class

2019-09-01 Thread Paul Procacci
I've actually found some weird inconsistancy while playing with this. sub matching_chars(Str $x, Str $y) { my $a := $x; my $b := $y; say $y.match: /<[$a]>/; } That results in a match of one character, yet: sub matching_chars(Str $x, Str $y) { my $a := $x; my $b := $y;