Last active
August 29, 2015 14:21
-
-
Save gdejohn/696ea85f806b2b43528f to your computer and use it in GitHub Desktop.
This file contains 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
Element[] quicksort<Element>({Element*} elements) | |
given Element satisfies Comparable<Element> => | |
if (exists first = elements.first) | |
then [first.largerThan, first.notLargerThan] | |
.map(compose(quicksort<Element>, elements.rest.filter)) | |
.interpose([first]) | |
.reduce(concatenate<Element>) | |
else []; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment