(define make-shifted
(lambda (shift-amount f)
(lambda (x)
(f (+ x shift-amount)))))
(define double
(lambda (x)
(* x 2)))
(define mystery
(make-shifted 5 double))
For each of the following expressions, indicate whether an error would
be signaled, the value would be a procedure, or the value would be
a number. If an error is signaled, explain briefly the nature of the
error. If the value is a procedure, specify how many arguments the
procedure expects. If the value is a number, specify which number.
make-shifted
mystery
(mystery 4)
(mystery double)
((make-shifted 3 double) 4)
((make-shifted 3 4) 5)
(make-shifted 3 double)
((make-shifted 3 (make-shifted 4 double)) 5)
prompt procedure on page 142. Explain what the point of
the modification is and give a concrete example (printed out from
DrScheme) illustrating its use.
(define prompt-for
(lambda (prompt-string ok?)
(newline)
(display prompt-string)
(newline)
(let ((value (read)))
(if (ok? value)
value
(prompt-for prompt-string ok?)))))