Permalink
Browse files

not that way clojure should be used.

  • Loading branch information...
1 parent 2ea97a8 commit ea605c9cfc40b3ef9e87883e9adf0076d8a6c454 @cherry-geqi cherry-geqi committed Dec 30, 2013
Showing with 2 additions and 10 deletions.
  1. +2 −10 clojure/pro1.clj
View
12 clojure/pro1.clj
@@ -1,10 +1,2 @@
-(defn rec [n sum num]
- (if (>= n num)
- sum
- (if (or (= 0 (mod n 3))
- (= 0 (mod n 5)))
- (rec (+ n 1) (+ sum n) num)
- (rec (+ n 1) sum num))))
-
-(defn pro1 [num]
- (rec 1 0 num))
+(defn p1 [n]
+ (apply + (filter #(or (= 0 (mod % 3)) (= 0 (mod % 5))) (range 1 n))))

0 comments on commit ea605c9

Please sign in to comment.