Created
October 25, 2011 16:12
-
-
Save notyy/1313294 to your computer and use it in GitHub Desktop.
quicksort in lisp
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
user=> (defn qs [l] | |
(if (< (count l) 2) l | |
(let [left (filter #(< % (first l)) (rest l)) | |
right (filter #(>= % (first l)) (rest l))] | |
(concat left (list (first l)) right)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment