]> git.rkrishnan.org Git - sicp.git/commitdiff
solution to 1.42
authorRamakrishnan Muthukrishnan <vu3rdd@gmail.com>
Thu, 27 May 2010 14:26:18 +0000 (19:56 +0530)
committerRamakrishnan Muthukrishnan <vu3rdd@gmail.com>
Thu, 27 May 2010 14:26:18 +0000 (19:56 +0530)
src/sicp/ex1_42.clj [new file with mode: 0644]

diff --git a/src/sicp/ex1_42.clj b/src/sicp/ex1_42.clj
new file mode 100644 (file)
index 0000000..1c0eef8
--- /dev/null
@@ -0,0 +1,14 @@
+(ns sicp.ex1_42
+  (:use [clojure.contrib test-is]
+       [sicp utils]
+       [sicp ch1_3]))
+
+(defn compose [f g]
+  (fn [x] (f (g x))))
+
+(comment
+((compose square inc) 6)
+;;=> 49
+((compose square square) 2)
+;;=> 16
+ )
\ No newline at end of file