Question
Winter is the season of the flu. The influenza virus spreads from one human to another. For this problem set, you will explore hypothetical health
Winter is the season of the flu. The influenza virus spreads from one human
to another. For this problem set, you will explore hypothetical health
files. Each patient is described by their name, age, whether or not they
have recieved the 2019 flu vaccine, the symptoms they present with, and a
list of other individuals that they are definitely known to have infected.
Please carefully read through the data definition for Patient provided for
you below. YOU MUST NOT EDIT THESE DATA DEFINITIONS OR CONSTANTS AT ALL.
(@htdd Patient ListOfPatient ListOfString) (define-struct patient (name age vac? symptoms transmits)) ;; Patient is (make-patient String Natural Boolean ListofString ListOfPatient) ;; interp. a patient with a name, ;; their age restricted to [1, 120] ;; vac? is true if patient has recieved the flu vaccine for 2019 ;; list of symptoms ;; list of people they are known to have infected
;; ListofPatient is one of: ;; - empty ;; - (cons Patient ListOfPatient) ;; interp. a list of patients
;; ListofString is one of: ;; - empty ;; - (cons String ListOfString) ;; interp. a list of strings
(define LOS0 empty) (define LOS1 (list "Fever")) (define LOS2 (list "Fever" "Fatigue" "Diarrhea")) (define LOS3 (list "Fatigue" "Diarrhea" "Vomiting")) (define LOS4 (list "Diarrhea" "Stomach pain")) (define LOS5 (list "Vomiting" "Stomach pain")) (define LOS6 (list "Fever" "Fatigue" "Stomach pain" "Vomiting"))
(define P1 (make-patient "Hu" 12 false LOS6 empty)) (define P2 (make-patient "Mandy" 6 true LOS2 empty)) (define P3 (make-patient "Tom" 65 false LOS4 empty)) (define P4 (make-patient "Akemi" 44 true LOS5 empty)) (define P5 (make-patient "Chung" 5 true LOS4 (list P1 P2 P3))) (define P6 (make-patient "Neda" 26 false LOS2 empty)) (define P7 (make-patient "Jill" 57 true LOS3 empty)) (define P8 (make-patient "Paul" 11 true LOS2 (list P6 P7))) (define P9 (make-patient "Simran" 5 true LOS1 (list P5 P4))) (define P10 (make-patient "Kathy" 6 false LOS0 (list P8 P9)))
(define LOP0 empty) (define LOP1 (list P1 P2 P3)) (define LOP2 (list P9 P8))
(define (fn-for-patient p) (... (patient-name p) (patient-age p) (patient-vac? p) (fn-for-los (patient-symptoms p)) (fn-for-lop (patient-transmits p)))) (define (fn-for-lop lop) (cond [(empty? lop) (...)] [else (... (fn-for-patient (first lop)) (fn-for-lop (rest lop)))]))
(define (fn-for-los los) (cond [(empty? los) (...)] [else (... (first los) (fn-for-los (rest los)))]))
(@problem 1) ;; ;; As a public health employee, one of your tasks is to determine the names ;; of all the patients a given person's infection has spread to. Design a ;; function that produces the list of all the names of patients in the ;; patient's tree including the given patient.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started