Structure and Interpretation of Computer Programs The Elements of Programming -1.1 1. Evaluate the following expressions in order, according to the evaluations rules of Scheme, and explain the results, and the errors. > (* (+ 5 6) -3) > (* 5 -6) > (* 5 - 6) > (5 * 6) > 5*6 > (* 2 5*6) > (define 5*6 (+ 2 2)) > 5*6 > (* 2 5*6) > (5 * (2 + 2)) > (5*6) > ( (* 5 6) ) 2. Define a procedure named 'squareDif' that takes 4 numbers as arguments and returns the square of the difference of the 2 smaller numbers. 3. Given the following two procedures: (define (p x) (p (+ x 1) ) ) (define (test x y) (if (= x 0) 0 y)) What is the result of evaluating the form (test 0 (p 1)) under applicative-order evaluation and under normal-order evaluation? 4. Consider the procedure "sqrt" defined in classes/class1, part 1.1.7, for computing square roots by Newton's method. There is also a Newton's method for computing forth roots, based on the following fact: If y is an approximation of the forth root of x, then (x/(y**3) + 3y):4 is a better approximation. Use this formula to implement a forth-root procedure, similar to the square-root procedure. 5. Suppose that we replace the primitive procedure "if" by a compound procedure "new-if", defined using "cond" as follows: (define (new-if predicate then-clause else-clause) (cond (predicate then-clause) (else else-clause))) For example: (new-if (= 5 5) 0 1) evaluates to 0, and (new-if (= 5 6) 0 1) evaluates to 1. Try it! Consider the following procedure for computing the factorial function: (define (factorial n) (new-if (= n 1) 1 (* n (factorial (- n 1) ) ) )) Try this definition of factorial. Explain what happens. 6. The following procedure 'power-close-to' finds the smallest power of its first argument, that is greater than its second argument. (define (power-close-to b n) (power-iter b n 1)) (define (power-iter b n e) (if (> (expt b e) n) e (power-iter b n (+ e 1)) )) Embed the definition of 'power-iter' inside 'power-close-to'. Take advantage of lexical scoping to remove unnecessary parameters from the embedded 'power-iter', and explain why you could remove those parameters.