CS212 Exams
Spring 1997 - Prelim 1

Evaluation of Scheme Expressions


For each of the following expressions determine what value would be returned by a Scheme interpreter, or describe what would happen if the expression is one that does not yield a value.
  1. (let ((x 10)(f +))
      (let* ((x (f x x))(y (f x x)))
        (f y y)))


  2. (let ((y 20))
      (let* ((x y)
             (f (lambda (x) (+ x y))))
        (f x)))


  3. (head (tail (head (tail '(1 (2 (4)) 5)))))


  4. ((lambda (f) (f f)) (lambda (g) (g g)))


  5. (+ ((lambda (x) x) 5) 4)



Solution

Return to CS 212 Prelim 1 - Spring 1997