]> git.rkrishnan.org Git - sicp.git/blobdiff - src/sicp/ex2_54.clj
Solution to 4.33. This had been difficult to get right, though conceptually it was
[sicp.git] / src / sicp / ex2_54.clj
index 0039c290c5f20fd823f05b6a462b2bc4ec559c96..3ed52d23b16a11433f61492b466620e08735be03 100644 (file)
@@ -10,7 +10,8 @@
     (= x y)))
 
 (defn equal? [a b]
-  (cond (empty? a) (empty? b)
+  (cond (and (atom? a) (atom? b)) (eq? a b)
+        (and (not (atom? a)) (not (atom? b))) (and (empty? a) (empty? b)) 
         (atom? (first a))
         (if (eq? (first a) (first b))
           (equal? (rest a) (rest b))