Differences

This shows you the differences between two versions of the page.

exercise_1.34 [2009/03/02 01:32] (current)
204.14.159.185 created
Line 1: Line 1:
 +//
 +Suppose we define the procedure
 +//
 +<code>
 +(define (f g)
 +  (g 2))
 +</code>
 +//
 +Then we have
 +//
 +<code>
 +(f square)
 +4
 +(f (lambda (z) (* z (+ z 1))))
 +6
 +</code>
 +//
 +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