diff --git a/1. Building Abstractions with Procedures/1.1.clj b/1. Building Abstractions with Procedures/1.1.clj index 2c0f831..262f945 100644 --- a/1. Building Abstractions with Procedures/1.1.clj +++ b/1. Building Abstractions with Procedures/1.1.clj @@ -172,3 +172,62 @@ circumference (defn >= [x y] (not (< x y))) ;#'sicp/>= + + +;Exercise 1.1 +10 +; + +(+ 5 3 4) +;12 + +(- 9 1) +;8 + +(/ 6 2) +;3 + +(+ (* 2 4) (- 4 6)) +;6 + +(def a 3) +;#'sicp/a + +(def b (+ a 1)) +;#'sicp/b + +(+ a b (* a b)) +;19 + +(= a b) +;false + +(if (and (> b a) (< b (* a b))) + b + a) +;4 + +(cond (= a 4) 6 + (= b 4) (+ 6 7 a) + :else 25) +;16 + +(+ 2 (if (> b a) b a)) +;6 + +(+ (cond (> a b) a + (< a b) b + :else -1)) +;4 + +;Exercise 1.2 +(/ (+ 5 + 4 + (- 2 + (- 3 + (+ 6 + (/ 4 5))))) + (* 3 + (- 6 2) + (- 2 7))) +;-37/150 diff --git a/README.md b/README.md index b17031f..405a93c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ # SICP-in-Clojure * Structure and Interpretation of Computer Programs 2/E * https://mitpress.mit.edu/sicp/ +* https://clojuredocs.org/