1.1 10 12 8 3 6 none none 19 false 4 16 6 16
1.2 (Couldn't really read it, but if my numbers are correct):
(/ (+ 5 4 (- 2 (- 3 (+ 6 (/ 4 5))))) (* 3 (- 6 2) (- 2 7)))
1.4 (define (a-plus-abs-b a b)
((if (> b 0) + -) a b))
The "if" will return the + operator if b is positive, thus the procedure returns a + b if b is positive. The "if" will return the - operator if b is negative (or zero), thus the procedure returns a - b. Subtracting a negative number is the same as adding the absolute value of that number, so this procedure will return the same value for a given and and either +/-b. Just like the name says.
1.5 In applicative order, the p is evaluated, but the definition is recursive, so it will continually be called, resulting in an infinite loop. In normal order, the p never gets evaluated because the first condition of the test is true, and thus returns 0.
1.6 Similar to the answer to 1.5, the recursive function is continuously evaluated before the test conditions are checked and an infinite loop condition is reached.
1.7 For small values, the result is off by a lot (ie, sqrt .00001 => .031356) and large values never finish. Changing to the new version gives a better value, for small numbers (ie sqrt .0001 => .00316) and large values actually finish.
1.8 procedure good-enough? doesn't change