Sorting algorithms/Permutation sort: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: changed whitespace and comments.)
(Added Arturo implementation)
Line 496: Line 496:
.include "../affichage.inc"
.include "../affichage.inc"
</lang>
</lang>

=={{header|Arturo}}==

<lang rebol>sorted?: function [arr][
previous: first arr

loop slice arr 1 (size arr)-1 'item [
if not? item > previous -> return false
previous: item
]
return true
]

permutationSort: function [items][
loop permutate items 'perm [
if sorted? perm -> return perm
]
]

print permutationSort [3 1 2 8 5 7 9 4 6]</lang>

{{out}}

<pre>1 2 3 4 5 6 7 8 9</pre>

=={{header|AutoHotkey}}==
=={{header|AutoHotkey}}==
ahk forum: [http://www.autohotkey.com/forum/post-276680.html#276680 discussion]
ahk forum: [http://www.autohotkey.com/forum/post-276680.html#276680 discussion]