This is probably a very easy question -- I'm just learning and stuck on it though.
Say I have something like:
%facts
car(blah1, red).
car(blah2, blue).
car(blah3, red).
car(blah4, red).
car(blah5, black).
And now I want to make a rule where if I type in 'blah' I will get back all the blahs that are also red. So, for example,
%rule
is_same(Blah_x, Blah_y) :-
And if I entered is_same(blah1, X)
the return would be X = blah1, X = blah3, X = blah4
. Where as if I entered is_same(blah1, blah2)
no is returned (because blah1
is red
and blah2
is blue
.