From a9876071348de57fb76194fac72164006f164add Mon Sep 17 00:00:00 2001 From: Ben Lickly Date: Tue, 11 Jan 2011 14:48:26 -0800 Subject: [PATCH] Added check of sufficiently new clojure version. This should prevent users of old clojure versions from running koans and getting strange results. --- src/path_to_enlightenment.clj | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/path_to_enlightenment.clj b/src/path_to_enlightenment.clj index a3051bb..13408d3 100644 --- a/src/path_to_enlightenment.clj +++ b/src/path_to_enlightenment.clj @@ -30,6 +30,14 @@ "destructuring" "refs"]) +(defn require-version [[required-major required-minor]] + (let [{:keys [major minor]} *clojure-version*] + (if (or (< major required-major) + (and (== major required-major) (< minor required-minor))) + (throw (Exception. (str "Clojure version " required-major "." + required-minor " or higher required.")))))) + (defn run [] + (require-version [1 3]) (apply load (doall (map (partial str "koans/") ordered-koans))) (println "You have achieved clojure enlightenment. Namaste."))