Re: Variable character class

2019-09-02 Thread Joseph Brenner
> The "implicit" alternation comes from interpolating a list (of subrules, > see below). I see. And that's discussed here (had to really look for it): https://docs.perl6.org/language/regexes#Quoted_lists_are_LTM_matches At first I was looking further down in the "Regex interpolation"

Re: Variable character class

2019-09-02 Thread Gianni Ceccarelli
On 2019-09-02 The Sidhekin wrote: > To have the (1-character) strings used a literals, rather than > compiled as subrules, put them in an array instead of a block wrapped > in angle brackets: > > sub contains( Str $chars, Str $_ ) { > my @arr = $chars.comb; > m:g/@arr+/ This looks to be

Re: Variable character class

2019-09-02 Thread Paul Procacci
I don't know then. I've created the following ticket: https://github.com/perl6/doc/issues/2999 Feel free to place your own input there if you feel the need. On Mon, Sep 2, 2019 at 12:37 PM William Michels wrote: > Sorry Paul, I don't get the correct answer in any of the three cases I >

Re: Variable character class

2019-09-02 Thread William Michels via perl6-users
Sorry Paul, I don't get the correct answer in any of the three cases I tried. Here's what 6Pad returns: https://perl6.github.io/6pad/ sub matching_chars(Str $chars_to_match, Str $str) { # warnings, treats as string not variable $str ~~ /<$_>/ given "<[$chars_to_match]>"; } say

Re: Variable character class

2019-09-02 Thread Paul Procacci
Was talking to folks over on the #perl6 IRC channel. It appears the recommended way is: sub matching_chars(Str $chars_to_match, Str $str) { # warnings, treats as string not variable $str ~~ /<$_>/ given "<[$chars_to_match]>"; } ~Paul On Sat, Aug 31, 2019 at 9:54 PM yary wrote: > I

Re: Variable character class

2019-09-02 Thread William Michels via perl6-users
Hi Aureliano! Others will certainly have a more informed answer, but I think it might be because: 1). Set operations in general in Perl6 (on characters, etc.) may use a unordered matching algorithm to enhance speed, and/or 2). I didn't explicitly call a "Sort" method, function or routine in