RosettaCodeData/Task/Permutations/Tailspin/permutations-2.tailspin
2024-10-16 18:07:41 -07:00

16 lines
341 B
Text

permutations templates
when <|=1> do [1] !
otherwise
n is $;
expand templates
p is $;
1..$n -> templates
k is $;
[$p(..$k - 1)..., $n, $p($k..)...] !
end !
end expand
$n - 1 -> # -> expand !
end permutations
alpha is ['ABCD'...];
[ $alpha::length -> permutations -> '$alpha($)...;' ] !