Skip to content

Instantly share code, notes, and snippets.

@xudifsd
Created August 31, 2015 08:42
Show Gist options
  • Save xudifsd/de5f05e526d9e9563ed1 to your computer and use it in GitHub Desktop.
Save xudifsd/de5f05e526d9e9563ed1 to your computer and use it in GitHub Desktop.
quick sort
(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