]> git.rkrishnan.org Git - sicp.git/commitdiff
solution to 2.59
authorRamakrishnan Muthukrishnan <vu3rdd@gmail.com>
Tue, 7 Sep 2010 10:55:41 +0000 (16:25 +0530)
committerRamakrishnan Muthukrishnan <vu3rdd@gmail.com>
Tue, 7 Sep 2010 10:55:41 +0000 (16:25 +0530)
src/sicp/ex2_59.clj [new file with mode: 0644]

diff --git a/src/sicp/ex2_59.clj b/src/sicp/ex2_59.clj
new file mode 100644 (file)
index 0000000..3c72869
--- /dev/null
@@ -0,0 +1,8 @@
+(ns sicp.ex2_59
+  (:use [clojure.test]
+        [sicp.ch2_3]))
+
+(defn union-set [set1 set2]
+  (cond (empty? set1) set2
+        (element-of-set? (first set1) set2) (union-set (rest set1) set2)
+        :else (cons (first set1) set2)))
\ No newline at end of file