CS 246 Programming Paradigms
Project #2
Due on Tuesday, February 26

 

Implement the module Shape as designed in Chapter 2 for Hudak. Also, implement the module Draw as designed in Chapter 4 of Hudak.

 

WHAT YOU HAVE TO SUBMIT

1) A print out of all your Haskell code files. Try to write them in a literate style.

2) Output of the program in Section 4.3 as well as the following program:

   rings = rungraphics $
               do w<- openWindow "Drawing Rings" (600, 500)
                  drawShapes w (reverse coloredCircles)
                  spaceClose w

   -- map is like apply in IFP. Takes a function and a list (map f l)
   -- returns a list containing the result of applying f to all elements of l
   -- i.e. map f [x1,x2,..,xn] -> [f x1, f x2, ..., f xn]

   conCircles = map circle [0.2,0.4..1.6]

   coloredCircles = zip [Black,Blue,Green,Cyan,Red,Magenta,Yellow,White] conCircles

You should write whatever function(s) needed, if any, to complete the above program.