diff --git a/src/sicp/chapter_1/part_1/ex_1_6.clj b/src/sicp/chapter_1/part_1/ex_1_6.clj index 6871a99..e567087 100644 --- a/src/sicp/chapter_1/part_1/ex_1_6.clj +++ b/src/sicp/chapter_1/part_1/ex_1_6.clj @@ -33,13 +33,13 @@ (defn sqrt-iter [guess x] (if (good-enough? guess x) - guess - (sqrt-iter (improve guess x) x))) + guess + (sqrt-iter (improve guess x) x))) (defn sqrt-iter-new-if [guess x] (new-if (good-enough? guess x) - guess - (sqrt-iter (improve guess x) x))) + guess + (sqrt-iter (improve guess x) x))) ; What happens when Alyssa attempts to use this to compute square roots? Explain. diff --git a/src/sicp/chapter_1/part_2/ex_1_9.clj b/src/sicp/chapter_1/part_2/ex_1_9.clj index f3a6d3e..edb41db 100644 --- a/src/sicp/chapter_1/part_2/ex_1_9.clj +++ b/src/sicp/chapter_1/part_2/ex_1_9.clj @@ -8,13 +8,13 @@ [a b] (if (= a 0) b - (inc (+ (dec a) b)))) ; linear recursive + (inc (+ (dec a) b)))) ; linear recursive (defn plus-v2 [a b] (if (= a 0) b - (+ (dec a) (inc b)))) ; linear iteration + (+ (dec a) (inc b)))) ; linear iteration ; Using the substitution model, illustrate the process generated by each procedure in evaluating (+ 4 5). ; Are these processes iterative or recursive? diff --git a/test/sicp/chapter_1/part_1/ex_1_5_test.clj b/test/sicp/chapter_1/part_1/ex_1_5_test.clj index 0679632..e1b968e 100644 --- a/test/sicp/chapter_1/part_1/ex_1_5_test.clj +++ b/test/sicp/chapter_1/part_1/ex_1_5_test.clj @@ -1,6 +1,6 @@ (ns sicp.chapter-1.part_1.ex-1-5-test (:require [clojure.test :refer [deftest is]] - [sicp.chapter-1.part_1.ex-1-5 :refer [test_1_5 p]])) + [sicp.chapter-1.part_1.ex-1-5 :refer [p test_1_5]])) (deftest test_1_5-test ; Normal: Operand "p" will not be evaluated until it's needed by some primitive operation. So result is 0. diff --git a/test/sicp/chapter_1/part_2/ex_1_18_test.clj b/test/sicp/chapter_1/part_2/ex_1_18_test.clj index c5ff09c..29ece59 100644 --- a/test/sicp/chapter_1/part_2/ex_1_18_test.clj +++ b/test/sicp/chapter_1/part_2/ex_1_18_test.clj @@ -1,6 +1,6 @@ (ns sicp.chapter-1.part_2.ex-1-18-test - (:require [clojure.test :refer [deftest is]]) - (:require [sicp.chapter-1.part_2.ex-1-18 :refer [mult]])) + (:require [clojure.test :refer [deftest is]] + [sicp.chapter-1.part_2.ex-1-18 :refer [mult]])) (deftest mult-test (is (= 0 (mult 0 19)))) diff --git a/test/sicp/chapter_1/part_2/ex_1_20_test.clj b/test/sicp/chapter_1/part_2/ex_1_20_test.clj index 0caae2b..8d057c9 100644 --- a/test/sicp/chapter_1/part_2/ex_1_20_test.clj +++ b/test/sicp/chapter_1/part_2/ex_1_20_test.clj @@ -1,6 +1,6 @@ (ns sicp.chapter-1.part_2.ex-1-20-test - (:require [clojure.test :refer [deftest is]]) - (:require [sicp.chapter-1.part_2.ex-1-20 :refer [gcd]])) + (:require [clojure.test :refer [deftest is]] + [sicp.chapter-1.part_2.ex-1-20 :refer [gcd]])) (deftest gcd-test (is (= 2 (gcd 206 40))) ; 4 times diff --git a/test/sicp/chapter_1/part_2/ex_1_21_test.clj b/test/sicp/chapter_1/part_2/ex_1_21_test.clj index 3601f18..ebf79ee 100644 --- a/test/sicp/chapter_1/part_2/ex_1_21_test.clj +++ b/test/sicp/chapter_1/part_2/ex_1_21_test.clj @@ -1,6 +1,6 @@ (ns sicp.chapter-1.part_2.ex-1-21-test - (:require [clojure.test :refer [deftest is]]) - (:require [sicp.chapter-1.part_2.ex-1-21 :refer [smallest-divisor]])) + (:require [clojure.test :refer [deftest is]] + [sicp.chapter-1.part_2.ex-1-21 :refer [smallest-divisor]])) (deftest smallest-divisor-test (is (= 199 (smallest-divisor 199))) diff --git a/test/sicp/chapter_1/part_2/ex_1_22_test.clj b/test/sicp/chapter_1/part_2/ex_1_22_test.clj index d79214b..7d6c669 100644 --- a/test/sicp/chapter_1/part_2/ex_1_22_test.clj +++ b/test/sicp/chapter_1/part_2/ex_1_22_test.clj @@ -1,6 +1,6 @@ (ns sicp.chapter-1.part_2.ex-1-22-test - (:require [clojure.test :refer [deftest is]]) - (:require [sicp.chapter-1.part_2.ex-1-22 :refer [find-primes]])) + (:require [clojure.test :refer [deftest is]] + [sicp.chapter-1.part_2.ex-1-22 :refer [find-primes]])) (deftest find-primes-test (is (= 5 (find-primes 1 5)))) ; Change arguments and see the output