Assignment 4
Due Date Mon 1/23 at 11:59pm
Possible Points 25
Purpose Writing functions that work with structures.
Graded Exercises
; An Event is a (make-event [0, 24) String String) (define-struct event [hr place host]) ; - where hr is the hour at which the event begins ; - place is where the event occurs ; - and host is the name of the host
Exercise 1 What functions are given by this structure definition? List them in a comment.
Exercise 2 Write a function that takes in two Events, e1 and e2, and outputs #true if e1 begins before e2. Assume they are on the same day.
Exercise 3 Write a function that given an Event will output the start of an invitation. For example, if Matt is hosting an event at 314 WVH at 6 p.m., the function will output "Come to Matt's event in 314 WVH at 6 p.m." Note: Keep in mind, that according to our data definition, 6 p.m. will be represented as 18 in the structure.
Exercise 4 Write a function, update-posn-x, that given a Posn and a Number, will output the same posn except the x coordinate will be changed to the given number.
Exercise 5 Write a function, update-posn-y, that given a Posn and a Number, will output the same posn except the y coordinate will be changed to the given number.
Exercise 6 problem 6: Write a function that given a Posn will output the quadrant the posn is in in number form (1, 2, 3, or 4). If it does not lie in a quadrant, output #false. For more information on quadrants in a cartesian grid, see here.