rotor in comb?

2022-08-27 Thread Marc Chantreux
hello people, Here is a little raku code to count all the digraphs from some text: my %digraphs = slurp.lc .comb(/<[a..z]>+/) .map( *.comb.rotor( 2 => -1, :!partial ).map: *.join ) .Bag; The first .comb match words then I map them to get digraphs but I thi

Re: rotor in comb?

2022-08-27 Thread Bruce Gray
> On Aug 27, 2022, at 10:56 AM, Marc Chantreux wrote: --snip-- > but I think it is possible to move the cursor backward in the comb regex. --snip-- I do *not* think you can ("move the cursor backward in the comb regex"); See https://docs.raku.org/routine/comb : ... "returns a Seq o

Re: rotor in comb?

2022-08-27 Thread William Michels via perl6-users
Hi Marc (and Bruce)! I'm adapting a "word frequency" answer posted by Sean McAfee on this list. The key seems to be adding the `:exhaustive` adverb to the `match` call. AFAIK comb will not accept this adverb, so `match will have to do for now: Sample Input (including quotes): “A horse, a horse,

Re: rotor in comb?

2022-08-27 Thread William Michels via perl6-users
Heads-up: code was correct in my last post, but the output is as follows (Rakudo v2021.06): ~$ raku -e '++(my %digraphs){$_} for slurp.lc.match(:global, :exhaustive, /<[a..z]>**2/); .say for %digraphs.sort(-*.value);' richard3.txt or => 4 rs => 3 ho => 3 se => 3 gd => 1 in => 1 fo => 1 om => 1 do

Re: Inconsistencies with "with" chained to "for"

2022-08-27 Thread Vadim Belman
Looks like it worth a bug report. I was probably stumbling upon this too for a couple of times. Best regards, Vadim Belman > On Aug 27, 2022, at 2:24 AM, Fernando Santagata > wrote: > > Hello, > I noticed this behavior: > > [0] > my @a = > [a b c d e] > [1] > .say with $_ for @a > () > [2