From 83f2c18927e5ab573d5b16c0befd340999e0f74b Mon Sep 17 00:00:00 2001
From: Ramakrishnan Muthukrishnan <vu3rdd@gmail.com>
Date: Tue, 7 Sep 2010 16:25:56 +0530
Subject: [PATCH] solution to 2.61

---
 src/sicp/ex2_61.clj | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 src/sicp/ex2_61.clj

diff --git a/src/sicp/ex2_61.clj b/src/sicp/ex2_61.clj
new file mode 100644
index 0000000..c897c61
--- /dev/null
+++ b/src/sicp/ex2_61.clj
@@ -0,0 +1,19 @@
+(ns sicp.ex2_61
+  (:use [sicp.ex2_54 :only (equal? eq?)]
+        [clojure.test]))
+
+(defn adjoin-set [x set]
+  (let [x1 (first set)]
+    (cond (empty? set) (cons x set)
+          (= x x1) set
+          (< x x1) (cons x set)          
+          (> x x1) (cons x1 (adjoin-set x (rest set))))))
+
+(deftest test-adjoin
+  (are [x y] [= x y]
+       (adjoin-set 0 '())    '(0)
+       (adjoin-set 1 '(2 3)) '(1 2 3)
+       (adjoin-set 3 '(1 2 3)) '(1 2 3)
+       (adjoin-set 3 '(1 2 4)) '(1 2 3 4)
+       (adjoin-set 4 '(1 2 4)) '(1 2 4)
+       (adjoin-set 4 '(1 2 3)) '(1 2 3 4)))
\ No newline at end of file
-- 
2.45.2