| Slide 14.30: Search (cont.) 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 ).
        
block_1 will not match against desoto_48 or with edsel_57.  
In this case we must backtrack a second time to see if there is another red item that we can find.  
This time we find the third clause in the database, and use that.
     red( apple_1 ).
     red( block_1 ).
     red( car_27 ).            /* third choice */
We now attempt the car goal again, but this time for car_27.  
Now recall what we said earlier about the dangers of over estimating the powers of Prolog.  
Prolog will try to match the goal car(car_27) against the database
     car( desoto_48 ).
     car( edsel_57 ).
This will fail.  
car_27 does not match with either desoto_48 or edsel_57.  
The following steps are taken next: