Commit f6c2f9b0 authored by nimrod's avatar nimrod
Browse files

Replace cond with if for shorter, clearer code.

parent 499b3277
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -4,9 +4,9 @@
(require '[clojure.math.numeric-tower :as math])

(defn prime? [x]
  (cond
  (if
    (integer? (math/sqrt x)) false
    :else (every?
    (every?
       (fn [y] (not= (mod x y) 0))
       (range 2 (math/ceil (math/sqrt x))))))