6.7

Week 8 Set a

home work!

Programming Language ISL

Due Date Mon at 9pm (Week 8)

Purpose Practice with local and using existing abstractions in ISL

Finger Exercises

Exercise 1 From HtDP, 269 and some of 270.

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.