You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
692 B
28 lines
692 B
2 years ago
|
|
||
|
Exercise 4.28: Eval uses
|
||
|
actual-value rather than eval to evaluate the operator before
|
||
|
passing it to apply, in order to force the value of the operator. Give
|
||
|
an example that demonstrates the need for this forcing.
|
||
|
|
||
|
Exercise 4.29: Exhibit a program that you would
|
||
|
expect to run much more slowly without memoization than with memoization.
|
||
|
Also, consider the following interaction, where the id procedure is
|
||
|
defined as in Exercise 4.27 and count starts at 0:
|
||
|
|
||
|
|
||
|
(define (square x) (* x x))
|
||
|
|
||
|
;;; L-Eval input:
|
||
|
(square (id 10))
|
||
|
|
||
|
;;; L-Eval value:
|
||
|
⟨response⟩
|
||
|
|
||
|
;;; L-Eval input:
|
||
|
count
|
||
|
|
||
|
;;; L-Eval value:
|
||
|
⟨response⟩
|
||
|
|
||
|
Give the responses both when the evaluator memoizes and when it does not.
|