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

17 lines
421 B
Text

lexicalPermutations2 templates
N is $;
[[1]] -> # !
when <|[<|[](=$N)>]> do $... !
otherwise
tails is $;
[1..$tails(1)::length + 1 -> templates
first is $;
$tails... -> [$first, $... -> templates
when <|$first..> do $ + 1!
otherwise $!
end] !
end] -> # !
end lexicalPermutations2
alpha is ['ABCD'...];
[ $alpha::length -> lexicalPermutations2 -> '$alpha($)...;' ] !