Hiya,
I have just started learning Prolog and I can't work out how to search a list for a member. I want to be able to search all the lists for a number of symptoms and then produce a list of all possible diseases. I can't even start by checking my lists for one symptom. The code is:
member(H,[H|T]).
member(X,[H|T]) :- member(X,T).
disease(cancer_pancreas([fatigue, pain, appetiteloss, nausea])).
disease(common_cold([fatigue, headache])).
When I use the listener and put in :
member(fatigue, disease(X)).
I always get no.
Am I making a really basic mistake? Any help appreciated.
Thanks
bb
I have just started learning Prolog and I can't work out how to search a list for a member. I want to be able to search all the lists for a number of symptoms and then produce a list of all possible diseases. I can't even start by checking my lists for one symptom. The code is:
member(H,[H|T]).
member(X,[H|T]) :- member(X,T).
disease(cancer_pancreas([fatigue, pain, appetiteloss, nausea])).
disease(common_cold([fatigue, headache])).
When I use the listener and put in :
member(fatigue, disease(X)).
I always get no.
Am I making a really basic mistake? Any help appreciated.
Thanks
bb