Created
April 17, 2016 04:34
-
-
Save oepn/e70a58d5422bb0c0af7531f7f5b616ed to your computer and use it in GitHub Desktop.
Haskell-inspired quicksort as an ES6 one-liner, because why not.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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