Month: December 2007

  • Exercise 10.3

    Prove is, to my mind, a strong word. But by substitution we can show that these functions are equivalent. First, the originals: adjust :: [(Color, Region)] -> Coordinate -> (Maybe (Color, Region), [(Color, Region)]) adjust regs p = case (break (\(_,r) -> r `containsR` p) regs) of (top, hit:rest) -> (Just hit, top++rest) (_, []) […]

  • Exercise 10.2

    Simply run the code given in the book. The Graphics.SOE package seems to be buggy with respect to updating the window properly. I had redraw bugs using both GHCI and Hugs (using Ubuntu 7.10 on x86_84).

  • Exercise 10.1

    This exercise is simply to execute the code given in the book. To draw the “five circles” example: draw “five circles” $ Region Blue $ Translate (-2,0) $ Scale (0.5, 0.5) fiveCircles Note: Technical errors 17, 18 and 19 apply to the code (in particular shapeToGRegion) in Chapter 10.