Let\'s say I want all permutations of 2 letters out of a, b and c.
I can do:
my @perm = .combinations(2)».permutations;
say @perm;
# [((
Ultimately, you are building your list the wrong way to begin with. You can slip
your permutations into the outer list like this.
.combinations(2).map(|*.permutations);
Which yields the following list
((a b) (b a) (a c) (c a) (b c) (c b))
According to the Bench module, this is about 300% faster than doing
.combinations(2).map(*.permutations)[*;*]