Skip to content

Instantly share code, notes, and snippets.

@stryju
Created October 6, 2015 07:56
Show Gist options
  • Save stryju/3b6c260a122402023a44 to your computer and use it in GitHub Desktop.
Save stryju/3b6c260a122402023a44 to your computer and use it in GitHub Desktop.
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