Skip to content

Instantly share code, notes, and snippets.

@stryju

stryju/quicksort.js

Created Oct 6, 2015
Embed
What would you like to do?
quicksort (haskell-inspired) in es6
function quicksort([ x, ...xs ]) {
if (!arguments[0].length) return [];
return [ ...xs.filter( y => y <= x ), x, ...xs.filter( y => y > x ) ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment