RosettaCodeData/Task/Permutations/Tailspin/permutations-2.tailspin

17 lines
341 B
Plaintext

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($)...;' ] !