Com Sci 105
Fundamentals of Computer Programming
Autumn 1998
Assignment 5
Electronic copy due: Sunday 11/22, 11:59 PM
Written part & hard copy due: Monday 11/23, beginning of class
The purpose of this assignment is to give you more practice with recursion
in Scheme. Run all problems
MacGambit, and hand them in online as well as in a
printout. For each problem, supply about 5 test cases to show that
your procedures do work as desired. Turn in the
tests (input & output) with the electronic copy, and with the hard
copy as well.
-
Write the function "repeated" in Scheme using recursion. Remember that "repeated" takes a function and a number as input and returns a function. What is the criterion for a function to be a valid argument to "repeated"?
- Write a predicate "prime" that takes an integer as input and returns true if and only if the integer is prime. (Hint: Use a helper procedure "divides' that takes two integers as input and returns true if there is some integer between 2 and the first integer that divides the second integer)
Last modified: Mon Oct 12 10:11:26 CDT 1998