CS 119 Lab 4
Objectives
Perform the following tasks in the order given.
1. Evaluate the files words.scm and lab4.scm.
2. Take a look at the function flip in lab4.scm. To demonstrate that this procedure returns another procedure as its value try:
(flip se)
The procedure that is returned takes two arguments a and b. To execute this procedure try:
((flip se) ‘goodbye ‘hello)
((flip -) 5 8)
3. Many functions are applicable only to arguments in a certain domain and result in error messages if given arguments outside that domain. For example, sqrt requires that its argument be a number. Once a program gets an error message, it is impossible for that program to continue the computation.
|
Assignment: Þ
(define safe-sqrt (type-check sqrt number?)) |
4. Take a look at the procedure gertrude. It does some redundant computation. Try:
(gertrude ‘rose)
(gertrude ‘iguana)
|
Assignment: |
5. Take a look at the procedure sum-square. What does this procedure do? How does it work?
6. Email your files containing the assignments to jzimmerm@goucher.edu.