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

Re: (sigils are awesome, they say ...) Re: pairs of separators froma string

Thread Previous | Thread Next
From:
Brian Duggan
Date:
August 22, 2021 15:42
Subject:
Re: (sigils are awesome, they say ...) Re: pairs of separators froma string
Message ID:
YSJwUPK6X9E1cSZ2@bduggan-C02DX7U3MD6R
On Sunday, August 22, Marc Chantreux wrote: 
> my ($a, $b) = { @^a[0,2...Inf], @a[1,3...Inf] }.(q<(){}[]>.comb); say $a[0]; say $b[0]
> 
> oh. i never see this direct call of a lambda before but it really makes
> sense! this is the answer i like the most.

I think it's possible to avoid the explicit lambda too and just
put the expression inside the postcircumfix operator --
  
raku -e 'say q<AaBbCcDd>.comb[ [0,2 ... *],[1,3 ... *] ]'

((A B C D) (a b c d))

Brian

Thread Previous | 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