Skip to content

Instantly share code, notes, and snippets.

@layflags
Created August 15, 2018 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save layflags/ff3f35ecb5f4d44692d0b4ae61f1e807 to your computer and use it in GitHub Desktop.
Save layflags/ff3f35ecb5f4d44692d0b4ae61f1e807 to your computer and use it in GitHub Desktop.
Quicksort in ES6+
const qs = ([x, ...xs]) =>
x === undefined
? []
: [
...qs(xs.filter(a => a <= x)),
x,
...qs(xs.filter(a => a > x))
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment