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

16 lines
360 B
Text

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