Exercise 1.1, in order:
10
12
8
3
6
(Nothing)
(Nothing)
19
f
4
16
6
16
Exercise 1.2:
(/ (+ 5 4 (- 2 (- 3 (+ 6 4/5))))
(* 3 (- 6 2) (- 2 7)))
Exercise 1.3:
; subtracts the square of the minimum from the sum of all squares
(define (ex13 a b c)
(let ((min (min a b c))
(sq (lambda (x) (* x x))))
(- (+ (sq a)
(sq b)
(sq c))
(sq min))))
Exercise 1.4:
The if function returns a procedure in either case, but causes the ultimate expression to be (+ a b) in the case of b > 0, and (- a b) in the case of b <= 0.
Exercise 1.5:
If the interpreter uses applicative-order evaluation, it will never return, stuck in the recursion of p. If it is using the normal-order evaluation (or lazy?) it will not even evaluate p and just return 0.
Exercise 1.6:
The new-if produces an infinite recursive loop, because it is evaluating both arguments.
Exercise 1.7:
Statements:
1) The good-enough? test used in computing square roots will not be very effective for finding the square roots of very small numbers.
A) The floating point numbers (presumably being used) are not always able to represent the exact decimal representation.
2) Also, in real computers, arithmetic operations are almost always performed with limited precision.
A) Same as last answer, for example a 64 bit floating point (IEEE 754 binary64) will support 52+1 digits in base 2, with an exponent from -1022 to +1023.
3) This makes our test inadequate for very large numbers.
A) Large numbers will suffer the same problem if it is beyond the precision limit.
Some examples of failure:
(sqrt-iter 1 0.000000005)
0.03125005328123188
Answer from calculator.app: 0.000070710678119
For (sqrt-iter 1 60000000000) it will not return for a long time, thinking the high number results in too many iterations. Numbers as low as 600000 show the length of time increasing.
-- Unable to finish the rest with available time.