U WS 03
1. Vertical Swatches
The vs function uses a list of 1x1 pixel squares to produce a
vertical column of 30x30 squares. Its signature is:
vs: List of Images -> Image
A correct check-expect for this function is:
(check-expect (vs (list (square 1 "solid" "blue")
(square 1 "solid" "orange")))
(above (square 30 "solid" "blue")
(square 30 "solid" "orange")))
Rewrite the incorrect function vs (below) so that it works properly
when given a list of 1x1 pixel squares.
;; vs: List of Image -> Image
(define (vs cs)
(above (scale 30 (first cs))
(scale 30 (vs (rest cs)))))
2. Universe Communication
Each world can send out a speech bubble, which we make a number to
keep this question simple. The world that spoke most recently is
orange. Other worlds are blue. Except if the world’s spoke field is
the same as the number just sent out by another world, in which case
the world turns green.
All of those changes should occur in the receive handler. You are
going to write a helper function for the receive handler. This helper
function rhh : modl msg -> string-color
puts out the new color of the world.
; modl has: id = number (1), spoke = number (7331); colr = color string ("blue")
(define-struct modl (id spoke colr))
; msg has: from = number, bub = number
(define-struct msg (from bub))
(define ex-world-1 (make-modl 1 7331 "blue"))
(define ex-world-2 (make-modl 2 5678 "blue"))
(check-expect (rhh ex-world-1
(make-msg 1 7331))
"orange")
(check-expect (rhh ex-world-2
(make-msg 1 5678))
"green")
(check-expect (rhh ex-world-2
(make-msg 1 9101))
"blue")