Created
April 3, 2019 07:44
-
-
Save ishankhare07/ee465392443e3d082c16f87356824525 to your computer and use it in GitHub Desktop.
prime number series generation in clojure
This file contains hidden or 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 prime? [x] | |
(def f (fn [i j] | |
(if (zero? (rem i j)) | |
false | |
(if (<= j (quot i j)) | |
(f i (+ j 1)) | |
true | |
)))) | |
(f x 2) | |
) | |
(take 100 (filter prime? (iterate inc 0))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not using argument de-structuring since it wasn't introduced in the course upto this point.
Hence I took it as a challenge to write it with (clojures) instead