Skip to content

Commit

Permalink
연습문제 1.1, 1.2 풀이
Browse files Browse the repository at this point in the history
  • Loading branch information
kang-hyungu committed Nov 9, 2015
1 parent 8cb1356 commit 9c4c748
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
59 changes: 59 additions & 0 deletions 1. Building Abstractions with Procedures/1.1.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SICP-in-Clojure
* Structure and Interpretation of Computer Programs 2/E
* https://mitpress.mit.edu/sicp/
* https://clojuredocs.org/

0 comments on commit 9c4c748

Please sign in to comment.