Data definitions:
;; Agradebook
(gb
) is:(Listof GBE)
. (define-struct gbe (name grades)) ;; AGBE
(grade-book entry) is: ;;(make-gbe symbol (Listof Number))
;; Example: (define gradebook (list (make-gbe 'ALICE (list 49 81 64)) (make-gbe 'BOB (list 16 31 27)) (make-gbe 'CARL (list 27 64 8))))
Exercise
;; students-in : GB → (Listof Symbol)
which enumerates the students in the course (duplicates are okay).
;; grades-of : GB Symbol → (Listof Number)
which extracts the grades for a given student from the given GB
.
;; total-of : GB Symbol → Number
computes the total score for a given student from the given GB
.
;; highest-total : GB → Number
which determines who has the highest total score in the class.
;; chart-grades : GB → Histogram
which consumes a gradebook and generates a histogram.
;; AHistogram
is:(Listof HistoLine)
. (define-struct histoline (name result)) ;; AHistoLine
is:(make-histoline Symbol String)
;; Note: theresult
string is at most 60 characters long.
Each item of the generated list is a name combined with a string representing the histogram entry. The longest string, representing the person with the highest grade, should be 60 characters long. Every other string should be proportionally shorter. You may need some math functions to help you compute the lengths of strings; once you’ve determined what functions you need, ask the TAs for help finding these in Scheme or experiment or use the HelpDesk.