Created
March 10, 2011 17:50
-
-
Save redacted/864546 to your computer and use it in GitHub Desktop.
quicksort
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
(defn qsort [[pivot & xs]] | |
(when pivot | |
(let [smaller #(< % pivot)] | |
(lazy-cat (qsort (filter smaller xs)) | |
[pivot] | |
(qsort (remove smaller xs)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment