|
Slide 14.32: Search (cont.) Home |
|
fun( X ) :- red( X ), car( X ).
fun( X ) :- blue( X ), bike(X).
red( apple_1 ). /* database of red items */
red( block_1 ).
red( car_27 ).
car( desoto_48 ). /* database of cars */
car( edsel_57 ).
bike( iris_8 ).
bike( my_bike ).
bike( honda_81 ).
bike(flower_3) against our bike database as above.
This again must fail, since flower_3 does not match against iris_8, my_bike, or honda_81.
So as before, we must backtrack and find an alternate blue item.
Recall our database:
blue( flower_3 ).
blue( glass_9 ).
blue( honda_81 ).
We have tried flower_3 without luck, so next we try the second blue fact, blue(glass_9).
bike(glass_9).
Again this fails to unify.
blue, blue(honda_81).
bike(honda_81) matches the clause three!.
?- fun( What ).
What=honda_81
yes