Given the word abcd, how would I construct the following nested list?
[ (abcd) (a bcd) (ab cd) (abc d) (a b cd) (a bc d) (ab c d) (a b c d) ]
That is splitting the word in every way it can be, while keeping the letters in order.
Nemokosch on #raku-beginner pointed me to .combinations and the module snip, but I'm having trouble putting it all together.
You could use match with :exhaustive:
"abcd"
andthen .match: /^ (\w+)+ $/,:ex
andthen .map: *.[0].put
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With