develooper Front page | perl.perl6.users | Postings from August 2021

Re: pairs of separators from a string

Thread Previous | Thread Next
August 22, 2021 01:24
Re: pairs of separators from a string
Message ID:
This reminds me of "the comma rule" which I haven't quite internalized yet.
This gets a little closer

map { .[0,2…∞], .[1,3…∞] }, ("012345".comb,)
(((0 2 4) (1 3 5)))

and my instinct is that "map" is adding a layer you don't need or want for
this issue, should just be sending the results of comb to a block. But I
can't quite get the syntax right (and seems down at the

I sent a variation of this as a potential question to Perl Weekly
Challenge, maybe it will get a bunch of answers in a few weeks!


On Sat, Aug 21, 2021 at 3:05 AM Marc Chantreux <> wrote:

> hello,
> i would like to get the list of opening (α) and closing
> (ω) separators from this string:
>     &""''(){}[]
> too many years of perl made me think about this solution
> or something alike but it didn't work.
> my (\α,\ω) =| map
>     { .[0,2…∞], .[1,3…∞] },
>     q&""''(){}[]&.comb;
> fixing this is important to me because it illustrate how bad i am to
> comprehend how raku flatten things.
> regards,
> marc

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About