Posted By

narkisr on 08/14/09


sort functional quick clojure

Versions (?)

Functional quick sort

 / Published in: Lisp


A Functional quick sort (Java imperative version seems to be quicker).

  1. (defn qsort-rs [[pivot & xs]]
  2. (when pivot
  3. (let [smaller #(< % pivot)]
  4. (lazy-cat (qsort (filter smaller xs))
  5. [pivot]
  6. (qsort (remove smaller xs))))))

Report this snippet  

You need to login to post a comment.