Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defn fact [x]
- (loop [n x
- ans 1]
- (if (= n 0)
- ans
- (recur (dec n) (* n ans)))))
- (defn fact2
- ([x] (fact2 x 1))
- ([x ans] (if (= x 0) ans (recur (dec x) (* x ans)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement