Permutations: Difference between revisions
Content deleted Content added
→{{header|Scheme}}: Add a much better version, translated from erlang |
Added Qi, translation of erlang |
||
Line 1,571:
(3, 2, 1)
</pre>
=={{header|Qi}}==
{{trans|Erlang}}
<lang qi>
(define seq
Start Start -> [Start]
Start End -> [Start|(seq (+ Start 1) End)])
(define append-lists
[] -> []
[A|B] -> (append A (append-lists B)))
(define permutate
[] -> [[]]
[H|T] -> (append-lists (map (/. P
(map (/. N
(insert P N H))
(seq 0 (length P))))
(permute T))))
</lang>
=={{header|R}}==
|