When you consult a rule in prolog you can press ; and prolog will continue to show the goals for these rule and a true at the end of every goal, is there any way to tell to prolog to do it automatically from within the rule?
For example, for:
distance(a,b,10).
distance(a,c,11).
distance(a,d,12).
distance(a,e,13).
distance(a,l,14).
distance(a,k,15).
distance(b,h,16).
distance(c,h,17).
distance(f,l,18).
distance(g,f,19).
distance(i,k,20).
distance(i,j,21).
distance(j,k,22).
connected_with(X) :- write('Point '), write(X), write(' connected with '),
distance(X,C,D), write(C), write('. Distance: '),
write(D), write(' meters.').
You can run:
?- connected_with(a).
Point a connected with b. Distance: 10 meters.
true
c. Distance: 11 meters.
true
d. Distance: 12 meters.
true
e. Distance: 13 meters.
true
l. Distance: 14 meters.
true
k. Distance: 15 meters.
true.
But to see the next goal you need to type ; , and there are the true s that I don't need to show.
Any idea of how to achieve this?