Last active
August 29, 2015 14:05
-
-
Save Deraen/cb04999f48bc242a0079 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn mrg [[x & xrest :as X] [y & yrest :as Y] R] | |
(if (and X Y) | |
(if (<= x y) | |
(recur xrest Y (conj R x)) | |
(recur X yrest (conj R y))) | |
(concat R X Y))) | |
(defn mrgsrt [X] | |
(if (> (count X) 1) | |
(let [[left right] (split-at (/ (count X) 2) X)] | |
(mrg (mrgsrt left) (mrgsrt right) [])) | |
X)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment