Permutations: Difference between revisions
→{{header|Common Lisp}}
Basicgames (talk | contribs) |
|||
Line 2,742:
(permute seq (length seq))
permutations)))</syntaxhighlight>
=={{header|Craft Basic}}==
<syntaxhighlight lang="basic">let n = 3
let i = n + 1
dim a[i]
for i = 1 to n
let a[i] = i
next i
do
for i = 1 to n
print a[i]
next i
print
let i = n
do
let i = i - 1
let b = i + 1
loopuntil (i = 0) or (a[i] < a[b])
let j = i + 1
let k = n
do
if j < k then
let t = a[j]
let a[j] = a[k]
let a[k] = t
let j = j + 1
let k = k - 1
endif
loop j < k
if i > 0 then
let j = i + 1
do
if a[j] < a[i] then
let j = j + 1
endif
loop a[j] < a[i]
let t = a[j]
let a[j] = a[i]
let a[i] = t
endif
loopuntil i = 0
end</syntaxhighlight>
=={{header|Crystal}}==
|