]> git.rkrishnan.org Git - sicp.git/blobdiff - src/sicp/ex1_32.clj
Merge branch 'master' of github.com:vu3rdd/sicp
[sicp.git] / src / sicp / ex1_32.clj
index 369b67768c57e83605895a850a46db5cc7ed1704..a2fc28bf9837d4a1a8d854681107ec839d757527 100644 (file)
     result
     (iter combiner null-value term (next a) next b (combiner (term a) result))))
 
+(def isum (fn [a b] (iaccumulate + 0 identity a inc b)))
+
+(def isum-cube (fn [a b] (iaccumulate + 0 cube a inc b)))
+
+(def iprod (fn [a b] (iaccumulate * 1 identity a inc b)))
+
 (deftest test-sum-of-integers-from-1-to-10
   (is (= (sum 1 10) (reduce + (range 1 11)))))
 
 (deftest test-prod-of-ints-from-1-to-10
   (is (= (prod 1 10) (reduce * (range 1 11)))))
 
-(def isum (fn [a b] (iaccumulate + 0 identity a inc b)))
-
-(def isum-cube (fn [a b] (iaccumulate + 0 cube a inc b)))
-
-(def iprod (fn [a b] (iaccumulate * 1 identity a inc b)))
-
 (deftest test-isum-of-integers-from-1-to-10
   (is (= (isum 1 10) (reduce + (range 1 11)))))