|
| I am need of some real good help. I am doing a small project as part
of my degree and really wanted to learn prolog, and now am stumbling
overmyself day by day.
Im creating a medical expert system in Swi-prolog.I will eventually
have to create a GUI for users to use, ive looked at JPL and im so
. I can create Interfaces and menus in Java but how do i take
the values entered at Fields at the GUI and process them in prolog and
return the results to Java interface which will return it? do you have
any idea?
also, more to do with the programming, i need to compare two lists.
The user will enter symptoms for an ailment, (e.g. List1) and i will
need to compare it with another list L2 ( the list of symptoms for a
particular ailment. e.g. Flu[cough,sneezing].
so compare L1 with L2 or L3 orL4 and return the corresponding ailment
{ e.g. Flu).
so far i have this much:
/ ****************************************
/
getlist([L|Lt]):-nl,
write('Enter Symptom, Type end. to finish'),nl,nl,
read(X),
not(X=end),
L=X,
getlist(Lt), !.
getlist([]).
/*knowledge base*/
ailment('the flu',[cold,cough],[]).
ailment('a fever',[chills,pain],[]).
contained([],[]).
contained([],_).
contained([H|T],L):- member([H|T],L).
member(X, [Y|_]):-X=Y.
member(X, [_|Y]):-member(X,Y).
diagnose:- getlist(L),contained(L,ailment(Symptom,[
L2],[])),write('the
diagnosis is probably:'),write(Symptom).
/ ****************************************
********/
But this doesnt work.
any help, is wonderful :)
( I already emailed Paul Singleton, sorry if u read this twice ) |
|