14 lines
390 B
Text
14 lines
390 B
Text
templates lexicalPermutations2
|
|
def N: $;
|
|
[[1]] -> #
|
|
when <[<[]($N)>]> do $... !
|
|
otherwise
|
|
def tails: $;
|
|
[1..$tails(1)::length+1 -> \(
|
|
def first: $;
|
|
$tails... -> [$first, $... -> \(when <$first..> do $+1! otherwise $!\)] !
|
|
\)] -> #
|
|
end lexicalPermutations2
|
|
|
|
def alpha: ['ABCD'...];
|
|
[ $alpha::length -> lexicalPermutations2 -> '$alpha($)...;' ] -> !OUT::write
|