Anonymous user
Permutations: Difference between revisions
m
→{{header|Tailspin}}: syntax update
m (→{{header|Tailspin}}: syntax update) |
|||
Line 6,609:
<1> [1] !
<>
def n: $
templates expand
def p: $
1..$n -> (def k: $
[$p(1..$k-1)..., $n, $p($k..-1)...] !) !
end expand
$n - 1 -> permutations -> expand !
end permutations
def alpha: ['ABCD'...];
[ $alpha::length -> permutations -> '
</lang>
{{out}}
Line 6,631:
<1> [1] !
<>
def n: $
def p: [ $n - 1 -> lexicalPermutations ];
1..$n -> (def k: $
def tail: [1..$n -> (<~$k> $
$p... -> [ $k, $tail($
end lexicalPermutations
def alpha: ['ABCD'...];
[ $alpha::length -> lexicalPermutations -> '
</lang>
{{out}}
|