2007-12-01から1ヶ月間の記事一覧

Exercise 1.5

Applicative order (test 0 (p)) ==> (#<procedure:test> 0 (p)) ; test ==> #<procedure:test> ; 手続きオブジェクトなので呼出しに向けて引数評価開始 ==> (#<procedure:test> 0 (p)) ; 0 ==> 0 ==> (#<procedure:test> 0 (p)) ; (p) ==> 無限ループって怖くね? Normal order (test 0 (p)) ==> (#<procedure:test> 0 (p)) ; test ==> #<procedure:test> ==> </procedure:test></procedure:test></procedure:test></procedure:test></procedure:test></procedure:test>…

4章へ

3章が大体終わって今日の帰りの電車からは4章になりそう. 時間取れなくてExercise全然進まないorz. いや,時間は作るんだ. 何とかしろ自分.

Exercise 1.4

Observe that our model of evaluation allows for combinations whose operators are compound expressions. Use this observation to describe the behavior of the following procedure: (define (a-plus-abs-b a b) ((if (> b 0) + -) a b)) 引用元:htt…

3章突入

一方読む方は3章に突入した。

Exercise 1.3

Define a procedure that takes three numbers as arguments and returns the sum of the squares of the two larger numbers. (define (sum-large2 x y z) (cond ((and (<= x y) (<= x z)) (+ y z)) ((and (<= y x) (<= y z)) (+ x z)) ((and (<= z x) (<= …

Exercise 1.2

Translate the following expression into prefix form. > (/ (+ 5 (+ 4 (- 2 (- 3 (+ 6 (/ 4 5)))))) (* 3 (- 6 2) (- 2 7))) -37/150

Exercise 1.1

Below is a sequence of expressions. What is the result printed by the interpreter in response to each expression? Assume that the sequence is to be evaluated in the order in which it is presented. 10 (+ 5 3 4) (- 9 1) (/ 6 2) (+ (* 2 4) (-…

今更ながらSICPを読む

今更ながらSICP(原著)を読みはじめたので進捗の記録代わりにExerciseを解いていきたいと思う.Structure and Interpretation of Computer Programs (MIT Electrical Engineering and Computer Science)作者: Harold Abelson,Gerald Jay Sussman,Julie Suss…