# MCS-177 Homework 5, Fall 2005

## Due: November 2, 2005

• Do exercise 5.15 on page 123.

• Exercise 5.x2: Suppose the following have been defined:
```(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.
1. `make-shifted`
2. `mystery`
3. `(mystery 4)`
4. `(mystery double)`
5. `((make-shifted 3 double) 4)`
6. `((make-shifted 3 4) 5)`
7. `(make-shifted 3 double)`
8. `((make-shifted 3 (make-shifted 4 double)) 5)`

• Do exercise 5.8 on page 120.

• Exercise 6.x1: The following procedure is a modified version of the `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)