From 6e1f44454d46e7e0c48033c27dfa759ccf9ee52f Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan Date: Tue, 7 Sep 2010 16:26:50 +0530 Subject: [PATCH] an important bug fixed on equal? function --- src/sicp/ex2_54.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)) -- 2.45.2