Skip to content

Instantly share code, notes, and snippets.

@oepn
Created April 17, 2016 04:34
Show Gist options
  • Save oepn/e70a58d5422bb0c0af7531f7f5b616ed to your computer and use it in GitHub Desktop.
Save oepn/e70a58d5422bb0c0af7531f7f5b616ed to your computer and use it in GitHub Desktop.
Haskell-inspired quicksort as an ES6 one-liner, because why not.
const quicksort = ([x, ...xs]) => typeof x === 'undefined' ? [] : [...quicksort(xs.filter(a => a <= x)), x, ...quicksort(xs.filter(a => a > x))];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment