From bad1100f70d0b0db37f5966ddd1034aafc4104e2 Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan Date: Tue, 4 May 2010 20:17:28 +0530 Subject: [PATCH] solution to 1.30 --- src/sicp/ex1_30.clj | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/sicp/ex1_30.clj diff --git a/src/sicp/ex1_30.clj b/src/sicp/ex1_30.clj new file mode 100644 index 0000000..e447a0a --- /dev/null +++ b/src/sicp/ex1_30.clj @@ -0,0 +1,10 @@ +(ns sicp.ex1_30 + (:use [sicp utils] + [clojure.contrib test-is])) + +(defn sum [term a next b] + (letfn [(iter-fn [a result] + (if (> a b) + result + (iter-fn (next a) (+ result (term a)))))] + (iter-fn a 0))) \ No newline at end of file -- 2.45.2