Week 6 Set c
Due Date Fri at 9:00pm (Week 6)
Purpose The purpose of this problem set is to practice the design of functions using existing abstractions in ISL.
Finger Exercises
Graded Exercises
Exercise 2 Design a world program that shows the horizontal, rightward movement of a red dot based on start and end specification. The main function must consume three numbers:
x0, the initial x coordinate of the dot’s position;
delta, the positive number of pixels the dot moves per tick; and
x-limit, a number larger than x0 that indicates how far the dot must move. Once the dot’s x coordinate exceeds x-limit, the program stops.
All fixed elements of this program are left to you.Hints (1) You will not be able to test the functions of this program, except for the rendering function. Work through the rest of the design recipe, and it will work out just fine.
(2) You may wish to re-read 16.3.
Exercise 3 Design the function replace using existing abstractions. The function consumes a list of numbers and a number n. It replaces all 0s in the list with two occurrences of n.