Write a scheme function called xy sums that consumes

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: where ;; h is a natural number between 1 and 12 inclusive ;; representing the hour of the appointment ;; m is a natural number between 0 and 59 inclusive ;; representing the minute of the appointment ;; t is a symbol, either 'AM or 'PM ;; representing the time of day in a 12-hour clock 1. Write a Scheme function called xy-sums that consumes a list of posn structures and produces a list of the sum of the x and y values of each point that has an integer value distance to the origin. Recall that the distance from a point to the origin is !2 + !2 . For example (xy-sums (list (make-posn 0 1) (make-posn 1 1) (make-posn 3 4) (make-posn -12 5))) produces (list 1 7 -7). Note that the predicate integer? produces true when it consumes an integer value and false otherwise. Assume that the x and y values of the posn structures are integers. It is not necessary to reflect this restriction in the contract. 2. Write a Scheme function book-appointments that consumes two app-time s...
View Full Document

Ask a homework question - tutors are online