CSC 160 Fall 2008 Homework 11
Assigned Dec 1, Due MONDAY Dec 8


Read Sections 16.1-16.6 of the textbook.

Do the following exercises:
  • Exercise 15.5.2: Develop a function named swap-x-y which takes in a posn and returns a new posn with the coordinates swapped: the x coordinate of the output should be the y coordinate of the input, and vice versa.

  • Exercise 15.5.3: Develop a function named scale-posn which takes in a number and a posn, and returns a posn formed by multiplying the number by each of the coordinates of the input posn. For example, (scale-posn 3 (make-posn 2 5)) "should be" (make-posn 6 15).

  • Exercise 15.5.7: Develop a function named choose-posn that takes in a string and two posns. The string should be either "first" or "second". The choose-posn function should return either the first or the second of its two posns, as directed by the string. (Hint: You probably want to use a conditional expression as the function body for this function.)




  • Grading Contract Purpose Data Analysis Examples Skeleton Inventory Definition Testing
    15.5.2 /3 /2 N/A /3 /3 /4 /12 /3
    15.5.3 /3 /2 N/A /3 /3 /4 /12 /3
    15.5.7 /3 /2 /6 /3 /3 /6 /16 /3



    Last Modified: 12/6/08