2025-11-18 Review Practice

More review exercises covering the fundamentals. Originally from enrichment.
  1. Make a data type Cir to hold a Point called pt and a Double called diam. This represents a circle with center pt and diameter diam.

  2. Make a data type Game to hold a String called name and a list of Cir called ccc.

  3. Write a function that doubles the diameter and leaves the center unchanged.

     larger :: Cir -> Cir
    
  4. Find the area of a circle with a given diameter.

     area :: Cir -> Double
    
  5. Subtract 0.5 from each y coordinate in the Game.

     lowerall :: Game -> Game
    
  6. Find the total area of all circles in the Game.

     fullArea :: Game -> Double
    
  7. Two circles overlap if their radii add to more than the distance between their centers.

     overlap :: Cir -> Cir -> Bool
    
  8. Find the first circle that overlaps one given circle. If there is no such circle, output Nothing.

     touching :: Cir -> [Cir] -> Maybe Cir
     touching given circs = undefined -- fix
    
    1. Recursion
    2. List comprehension plus something
    3. Higher order function (map, fold, filter)
Last modified November 21, 2025: Haskell practice and quiz materials. (2542e6b)