From: Ramakrishnan Muthukrishnan Date: Tue, 7 Sep 2010 10:56:50 +0000 (+0530) Subject: an important bug fixed on equal? function X-Git-Url: https://git.rkrishnan.org/pf/content/en/components/com_hotproperty/something?a=commitdiff_plain;h=6e1f44454d46e7e0c48033c27dfa759ccf9ee52f;p=sicp.git an important bug fixed on equal? function --- diff --git a/src/sicp/ex2_54.clj b/src/sicp/ex2_54.clj index 0039c29..3ed52d2 100644 --- a/src/sicp/ex2_54.clj +++ b/src/sicp/ex2_54.clj @@ -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))