Reputation: 560
I have the following clauses:
a(1).
a(a).
b(3).
b(a).
c(A,B) :- b(B),!,a(A).
c(X,_) :- a(X),b(X).
Query c(A,B)
only returns two solutions: A = 1, B = 3 and A = a, B = 3.
I traced c(A,B)
and noticed that Prolog doesn't even try the second clause (c(X,_))
. Why is that so?
Upvotes: 1
Views: 1005