Posted By

narkisr on 08/14/09


Tagged

sort functional quick clojure


Versions (?)

Functional quick sort


 / Published in: Lisp
 

URL: http://rosettacode.org/wiki/Quicksort#Clojure

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.