Variables and Unification (Cont.)


Variable Example II (Cont.)
   tape( 1, van_morrison, astral_weeks, madam_george ).
   tape( 2, beatles, sgt_pepper, a_day_in_the_life ).
   tape( 3, beatles, abbey_road, something ).
   tape( 4, rolling_stones, sticky_fingers, brown_sugar ).
   tape( 5, eagles, hotel_california, new_kid_in_town ).
One more query:
   ?- tape( 4, rolling_stones, sticky_fingers, Song).
             /* Find just the song. */
   Song = brown_sugar        /* Which you like best */
   yes

Variable Exercise
Here are some problems for which unification sometimes succeeds and sometimes fails. Indicate the outcome of the proposed match using the yes/no buttons.

eats( fred, tomatoes ).
eats( Whom, What ).



eats( fred, Food )
eats( Person, jim ).

cd( 29, beatles, sgt_pepper).
cd( A, B, help ).

f( X, a ).
f( a, X ).

likes( jane, X ).
likes( X, jim ).

f( X, Y ).
f( P, P ).

f( foo, L ).
f( A1, A1 ).