6.7

Week 3 Set b

home work!

Programming Language BSL

Due Date Wed at 9pm (Week 3)

Purpose Atomic data are boring. In program design, the action is in structured data.

Finger Exercises

Exercise 1 From HtDP 64, 65, and 66. Read the last two completely before you tackle them.

Exercise 2 Design the function move, which consumes a Posn and adds 3 to the x and y coordinate each.

Exercise 3 Consider this structure type definition:
(define-struct participant (address word))
; A Participant is a structure:
;   (make-participant Number String)
; INTERPRETATION (make-participant n w) says the participant is
; located at n and his/her most recent utterance was w

Design the function update. It consumes a Participant and a String s. It returns a Participant that is like the given one except that the word field is now s.

Graded Exercises

Exercise 4 Design posn-. The function consumes two Posns, p and q. To create the resulting Posn, it subtracts the x coordinate of q from the one of p and the y coordinate of q from that of p.

Exercise 5 From HtDP, 73.