Suppose we define the procedure

(define (f g)
  (g 2))

Then we have

(f square)
4

(f (lambda (z) (* z (+ z 1))))
6

What happens if we (perversely) ask the interpreter to evaluate the combination (f f)? Explain.

Answer: Failure, because (f f) evaluates to (f 2), but then we get (2 2); the first 2 is not a function so the interpreter fails.

 
exercise_1.34.txt · Last modified: 2009/03/02 01:32 by 204.14.159.185
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki