Permalink
Browse files

fix recursive odd?/even?

  • Loading branch information...
1 parent 9443315 commit bcc7c58862982a5793e22788fc11a9ed7ffc548f @cemerick cemerick committed Sep 9, 2013
Showing with 4 additions and 3 deletions.
  1. +4 −3 ch01-welcome-repl-interactions.clj
@@ -1,4 +1,3 @@
-
;-----
(defn average
[numbers]
@@ -542,10 +541,12 @@ p
;-----
(letfn [(odd? [n]
- (even? (dec n)))
+ (if (zero? n)
+ false
+ (even? (dec n))))
(even? [n]
(or (zero? n)
- (odd? (dec n))))]
+ (odd? (dec n))))]
(odd? 11))
;= true

0 comments on commit bcc7c58

Please sign in to comment.