From 9823a764a5c40811621967fda7beaba9c162bb86 Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan <vu3rdd@gmail.com> Date: Thu, 27 May 2010 19:56:12 +0530 Subject: [PATCH] solution to 1.41 --- src/sicp/ex1_41.clj | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/sicp/ex1_41.clj diff --git a/src/sicp/ex1_41.clj b/src/sicp/ex1_41.clj new file mode 100644 index 0000000..17bf21c --- /dev/null +++ b/src/sicp/ex1_41.clj @@ -0,0 +1,22 @@ +(ns sicp.ex1_41 + (:use [clojure.contrib test-is] + [sicp utils] + [sicp ch1_3])) + +(defn doub [f] + (fn [x] (f (f x)))) + +(comment +(((doub (doub doub)) inc) 5) +;;=> 21 +user> ((doub inc) 1) +;;=> 3 +user> (((doub doub) inc) 1) +;;=> 5 +user> (((doub (doub doub)) inc) 1) +;;=> 17 +user> (((doub (doub (doub doub))) inc) 1) +;;=> 257 +user> (((doub (doub (doub (doub doub)))) inc) 1) +;;=> 65537 +) \ No newline at end of file -- 2.45.2