Skip to content
Snippets Groups Projects
Commit f6c2f9b0 authored by nimrod's avatar nimrod
Browse files

Replace cond with if for shorter, clearer code.

parent 499b3277
Branches
No related tags found
No related merge requests found
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
(require '[clojure.math.numeric-tower :as math]) (require '[clojure.math.numeric-tower :as math])
(defn prime? [x] (defn prime? [x]
(cond (if
(integer? (math/sqrt x)) false (integer? (math/sqrt x)) false
:else (every? (every?
(fn [y] (not= (mod x y) 0)) (fn [y] (not= (mod x y) 0))
(range 2 (math/ceil (math/sqrt x)))))) (range 2 (math/ceil (math/sqrt x))))))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment