From 9c4c74882bb96d550c1cf5ed5a214247e3345941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=A1=E1=86=BC=E1=84=92=E1=85=A7=E1=86=AB?= =?UTF-8?q?=E1=84=80=E1=85=AE?= Date: Tue, 10 Nov 2015 01:08:12 +0900 Subject: [PATCH] =?UTF-8?q?=EC=97=B0=EC=8A=B5=EB=AC=B8=EC=A0=9C=201.1,=201?= =?UTF-8?q?.2=20=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../1.1.clj | 59 +++++++++++++++++++ README.md | 1 + 2 files changed, 60 insertions(+) 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/