Question: I have a SWI-Prolog program that accepts user input symptoms and travel locations and adds the inputs to separate lists. I also have a database
I have a SWI-Prolog program that accepts user input "symptoms" and "travel locations" and adds the inputs to separate lists. I also have a database that looks like this
symptom(tetanus,hypertonia).
symptom(tetanus,painful_muscle_contractions).
symptom(tetanus,muscle_spasms).
test(tetanus,physical_exam).
locale(tetanus,global).
treatment(tetanus,wound_care).
treatment(tetanus,antitoxin).
treatment(tetanus,antibiotics).
treatment(tetanus,vaccination).
treatment(tetanus,sedatives).
with about 50 more entries similar.
How can I compare the Lists to the database and add the possible diseases to another list?
For example, if the user enters "hypertonia" as a symptom, how do i add tetanus to a list of possible diseases.?
Heres how I am getting the symptoms from the user an will do the same for locations.
getSymptoms(Symptoms) :- write('Please enter symptoms now, enter "Done" when finished: ' ), read_string(user, " ", " ", _, Response), ( Response == "Done" -> Symptoms = [] ; getSymptoms(Symptoms0), Symptoms = [Response|Symptoms0] ).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
