Before we tackle lists, we'll get used to simply building and and manipulating structured data. Remember to follow the design recipe.
- Provide a datatype definition for a structure called a pit, representing points in time since midnight. A point in time consists of three numbers: hours, minutes, and seconds.
Now develop the function time-diff. It consumes two pits, t1 and t2, and returns the number of seconds from t1 to t2.
For example:(time-diff (make-pit 1 2 3) (make-pit 4 5 6))
should yield 10983. - Provide a structure definition and a data definition for a game-score. A game-score is characterized by two pieces of information: a symbol representing the name of the team and a number representing the points-scored by that team.
- Develop a function that consumes two game-scores from a particular game and returns the name of the team that won or
'tieif the scores were equal. - Develop a datatype definition for a position in two-dimensional space called a posn. A posn should have an x and a y coordinate.
- Provide a datatype definition for shapes. There are three kinds of shapes:
• A circle has a center (center isa posn?) and a radius (radius isa number?)
• A square has an upper-left corner (corner isa posn?) and a length (length isa number?)
• A rectangle has an upper-left corner (corner isa posn?), width (width isa number?), and height (height isa number?)
In each case, remember to provide a clear comment regarding the structure along with its definition.Develop the function area that consumes a shape and computes its area. - Develop the function in-shape? that consumes a shape and a posn, and returns true if that posn is within the shape, false otherwise.
