big-bang 04

Setup:

(define (short n) 
  (beside (rectangle (- n 20) 10 "solid" "yellow")
          (square 20 "solid" "goldenrod")))
(define initial (short 300))
(define (draw-h-4 m)
  (overlay/align "right" "bottom" 
                 m (rectangle 300 200 "solid" "lightblue")))
(big-bang initial
  (on-draw draw-h-4)
  (on-mouse melody))
  1. What “kind of thing” is the model? (Same question, restated: what is the type of the model?)

  2. What is the signature of draw-h-4?

  3. Make an accurate drawing of the first image shown.

  4. What is the name and signature for the mouse handler?

  5. Write a check-expect for the mouse handler that shows that when the old model is initial and you move the mouse to coordinates (30, 75), the new model is demo1:

     (define demo1 (above (short 280) (square 10 "solid" "red")))
    
  6. Write a purpose for the mouse handler. What do you think it does?

  7. Make a diagram with 3 columns showing the models in the top row (with mouse motion between them) and the result of applying the draw handler in the second row.

  8. Write a check-expect for the mouse handler, showing exactly what happens when you move the mouse with the old model being demo1.

Last modified October 19, 2021: Site updates (7bc1cc8)