Created
March 8, 2015 08:26
-
-
Save bcho/a6e578fde62e7113faa2 to your computer and use it in GitHub Desktop.
trick
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
| (def arr (-> 100 range shuffle)) | |
| (defn qsort [[pivot & remains]] | |
| (when pivot | |
| (let [left (for [x remains :when (< x pivot)] x) | |
| right (for [x remains :when (> x pivot)] x)] | |
| (lazy-cat (qsort left) (list pivot) (qsort right))))) | |
| (-> arr qsort prn) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment