I'm doing the really early exercises, and I want to check my answers, as it were.
Watch for spoilers! My answers ahead! TURN BACK NOW!
1.1: 10,12,8,3,6,3,4,19,0,4,16,6,16
1.2:
(/ (+ 5 4 (- 2 (- 3 (+ 6 (/ 1 3) ) ) ) ) (* 3 (- 6 2) (- 2 7)))
Yeilded -(43)/(180). Seems wierd to me. Reason for this post.
1.3:
(define (square-two-bigger-add x y z) (cond ((and (> x z) (> y z) ) (+ (* x x) (* y y))) ((and (> y x) (> z x) ) (+ (* y y) (* z z))) ((and (> x y) (> z y)) (+ (* y y) (* z z))) ))
1.4: If B is positive, add a and b. If not, subtract b from a.
1.5: An applicative-order evaluation returns 0, and a normal-order evaluation never ends. Oh, and because it tries to expand p infinitly, whereas AO never evaluates p.
So, am I right?
And do these forums have a [ SPOILER ] tag? And why doesn't the [ SOURCE ] tag recognize lang="scheme" as correct?
[Edited by - EmrldDrgn on December 24, 2006 1:57:23 AM]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~I program in C++, on MSVC++ '05 Express, and on Windows. Most of my programs are also for windows.