I made my own version of merge sort:    (defn rsort[a]      (cond         (<= (count a) 1) a        :else           (let [half    (/ (count a) 2)                 [lh rh] (split-at half a)]            (loop [res () slh (rsort lh) srh (rsort rh)]              (cond                 (empty? slh) (into srh res)                (empty? srh) (into slh res)                :else                   (if (< (first slh) (first srh))                    (recur (cons (first slh) res) (rest slh) srh)                    (recur (cons (first srh) res) slh (rest srh))))))))Any suggestion how improve this code?
Merge sort in Clojure
algorithm;sorting;clojure;mergesort
I tested with a couple of input values and for the most part, it seemfine.  Note however, that the standard sort also works withe.g. [1 nil] (with output [nil 1]) whereas this code breaks with anexception during the comparison.Code looks fine with a few minor issues:The name should be merge-sort; rsort is not meaningful.The values (first slh) and (first srh) are written down twice; thecompiler might optimise that away, but IMO it would be nicer to have aseparate let for them.Emacs' clojure-mode indents the :else branch differently, dunnoabout that.Some suggestions:Support the same signature as the standard sort.Add a docstring explaining the function.Add tests, possibly with randomised input as well.