Sorting algorithms/Quicksort: Difference between revisions
Content added Content deleted
Line 886:
=={{header|CoffeeScript}}==
<lang coffeescript>
▲quicksort = (a) ->
smallerOrEqual = (a for a in xs when a <= x)
larger = (a for a in xs when a > x)
▲ return if i == j
(quicksort smallerOrEqual).concat(x).concat(quicksort larger)
# test
console.log quicksort a
▲ a = [1, 3, 5, 7, 9, 8, 6, 4, 2, 0, 3.5]
▲ console.log a # [ 0, 1, 2, 3, 3.5, 4, 5, 6, 7, 8, 9 ]
</lang>
=={{header|Common Lisp}}==
|