Created
August 31, 2015 08:42
-
-
Save xudifsd/de5f05e526d9e9563ed1 to your computer and use it in GitHub Desktop.
quick sort
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 [l] | |
(if (empty? l) '() | |
(let [f (first l) | |
smaller (filter #(<= % f) (rest l)) | |
bigger (filter #(> % f) (rest l))] | |
(concat (qsort smaller) [f] (qsort bigger))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment