Skip to content

Instantly share code, notes, and snippets.

@2colours
Created February 7, 2023 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2colours/d4d247d98fa2d6071069387aaad4844a to your computer and use it in GitHub Desktop.
Save 2colours/d4d247d98fa2d6071069387aaad4844a to your computer and use it in GitHub Desktop.
use v6.*;
my $str = "abcd";
my @split-positions <== 0 ^..^ $str.chars andthen .combinations;
my @splitters <== @split-positions>>.map: { *.key < $_ };
@splitters.map({ $str.comb.pairs.snip($_)>>.value>>.join }).say;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment