Sorting algorithms/Stooge sort: Difference between revisions

Content added Content deleted
(Adds Clojure solution)
Line 511: Line 511:
</pre>
</pre>
=={{header|Elena}}==
=={{header|Elena}}==
ELENA 3.2.1 :
ELENA 3.4 :
<lang elena>import extensions.
<lang elena>import extensions.
import system'routines.
import system'routines.

extension $op
extension op
{
{
stoogeSort
stoogeSort
= self stoogeSort(0, self length - 1).
= self stoogeSort(0, self length - 1).
stoogeSort(IntNumber i, IntNumber j)
stoogeSort(IntNumber i, IntNumber j)
[
[
Line 535: Line 535:
]
]
}
}

program =
public program
[
[
var list := 0 to:15 repeat(:n)(randomGenerator eval(20)); toArray.
var list := 0 to:15 repeat(:n)(randomGenerator eval(20)); toArray.
console printLine("before:", list).
console printLine("before:", list).
console printLine("after:", list stoogeSort).
console printLine("after:", list stoogeSort).
].</lang>
]</lang>
{{out}}
{{out}}
<pre>
<pre>