6.7

Week 5 Set c

home work!

Programming Language BSL

Due Date Fri at 9pm (Week 5)

Purpose Recovery from the first midterm, light exercises on design with nested structures

Finger Exercises

Exercise 1 From HtDP, 187 and/or 190.

Exercise 2 Design n-vec*x. The function consumes a number k k and a list of Vecs. It produces a list of Vecs by multiplying the x coordinate of each Vec on the given list with k.

Graded Exercises

Exercise 3 Design classify. The function consumes a Digit d and a Binary:
(define-struct binary [evens odds])
; A Binary is a structure:
; (make-binary List-of-evens List-of-odds)
; 
; A List-of-evens is one of:
;  '()
;  (cons Even List-of-evens)
; 
; A List-of-odds is one of:
;  '()
;  (cons Odd List-of-odds)
; 
; An Odd is one of:
;   1, 3, 5, 7, 9
; An Even is one of:
;   0, 2, 4, 6, 8
; A Digit is either an Odd or an Even

It produces a Binary that contains the given digit at the end of the appropriate list of the given one.