develooper Front page | perl.perl6.users | Postings from July 2020

Learning the "ff" (flipflop) infix operator? (was Re: Raku versionof "The top 10 tricks... .")

Thread Next
From:
William Michels via perl6-users
Date:
July 25, 2020 20:16
Subject:
Learning the "ff" (flipflop) infix operator? (was Re: Raku versionof "The top 10 tricks... .")
Message ID:
CAA99HCwg24ih801B+Q34cMt3Cix6zf3THaSUp67XwkfeNerbmw@mail.gmail.com
Hello,

I'm trying to learn the "ff" (flipflop) infix operator, generally
taking examples from the docs (below):

https://docs.raku.org/routine/ff

I tried adding in an "m:1st" adverb and an "m:2nd" adverb, but the
output isn't what I expect with the "m:2nd" adverb (examples #3 and
#5):

say "\n1. ----";
for <AB C D B E F> {
    say $_ if /A/ ff /B/;  # OUTPUT: «AB␤»
}

say "\n2. ----";
#mine
for <AB C D B E F> {
    say $_ if /A/ ff m:1st/B/;  # OUTPUT: «AB␤»
}

say "\n3. ----";
#mine
for <AB C D B E F> {
    say $_ if /A/ ff m:2nd/B/;  # OUTPUT: «AB␤C␤D␤B␤E␤F␤»
}

say "\n4. ----";
for <AB C D B E F> {
    say $_ if /C/ ff *;    # OUTPUT: «C␤D␤B␤E␤F␤»
}

say "\n5. ----";
#mine
for <AB C D B E F> {
    say $_ if m:2nd/B/ ff *;    # OUTPUT: blank
}

I'm wondering if I'm using the correct "flipflop" operator, since
"ff", "ff^", "fff", and "fff^" are all provided in Raku.

Any assistance appreciated, Bill.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About