From: Ramakrishnan Muthukrishnan Date: Tue, 4 May 2010 14:47:28 +0000 (+0530) Subject: solution to 1.30 X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/biz/customer.html?a=commitdiff_plain;h=bad1100f70d0b0db37f5966ddd1034aafc4104e2;p=sicp.git solution to 1.30 --- 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