関数型でやるとこんな感じ?
(defn insert [sorted-coll val] (concat (filter #(> val %) sorted-coll) [val] (filter #(<= val %) sorted-coll))) (defn insertion-sort [coll] (loop [vals (rest coll) sorted-coll (list (first coll))] (if (empty? vals) sorted-coll (recur (rest vals) (insert sorted-coll (first vals))))))