Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: [Raku] Ranges in array slices

by Athanasius (Archbishop)
on Jun 01, 2021 at 06:26 UTC ( [id://11133345]=note: print w/replies, xml ) Need Help??


in reply to Re: [Raku] Ranges in array slices
in thread [Raku] Ranges in array slices

Hello holli,

Thanks, that’s brilliant!

Note for my fellow Raku-challenged monks: My first thought on seeing holli’s code was that flat was taking the range 6..9 as its argument. But, of course, the argument to flat here is the whole comma-separated list: 6..9, 23, 25. So the following constructs both solve my problem:

16:21 >raku -e "my @c = 'a'..'z'; @c[flat 6..9, 23, 25].map( { qq[<$_> +] } ).raku.put;" ("<g>", "<h>", "<i>", "<j>", "<x>", "<z>").Seq 16:21 >raku -e "my @c = 'a'..'z'; @c[ (6..9, 23, 25).flat ].map( { qq[ +<$_>] } ).raku.put;" ("<g>", "<h>", "<i>", "<j>", "<x>", "<z>").Seq 16:22 >

Thanks again,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11133345]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-03-29 07:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found