I'm new to prolog, but basically, I want a program to iterate through the predicates(not sure if I'm using that term correctly) and then come to a final predicate which can process the input and provide one of two answers. The ask and the maplist were my tries at iterating through the program the way a program like Java would. (Also, sidenote, but is there any way to have the user input Yes and No instead of true. and false.?) Here's how my code looks currently:
ask(happy,X).
ask(lonely,X).
ask(education,X).
ask(institution,X).
ask(home,X).
ask(parents,X).
ask(social_life,X).
ask(hobbies,X).
ask(opinion,X).
ask(relationship,X).
ask(finances,X).
ask(future,X).
ask(freedom,X).
ask(feelings,X).
maplist(ask(_), Xs).
Xs= [happy(X),lonely(X),education(X),institution(X), home(X),
parents(X), social_life(X), hobbies(X), opinion(X), relationship(X),
finances(X), future(X), freedom(X),feelings(X)].
happy(X):-
write("Are you happy?"),nl,
read(X).
lonely(X):-
write("Are you lonely?"),nl,
read(X).
main
predicate. - Willem Van Onsem