so I have a fact weather(jan, 17, cold, wind, snow).
and rule
match(W,D,T) :-
weather(W,D,T,_,_)
; weather(W,D,_,T,_)
; weather(W,D,_,_,T).
When I type match(jan, 17, wind).
Prolog returns true; false.
I want it to only return true, but it's returning false as well, how can I fix this?
weather/5
has some built-in ambiguity since the 3rd, 4th, and 5th arguments can interchangeably mean anything. Therefore, if you try to write a suitably general predicate likematch/3
, it's going to have choice points. When you seetrue
as a prompt, that means Prolog succeeded but there was a choice point it needs to go back to check for another possible solution (since, if it were in the database,weather(jan, 17, wind, snow, cold)
would also be a possible valid fact that would match). Prolog will eventually givefalse
when it finds no more solutions. Normal. – lurker