Question: Consider the following Prolog program: box ( yellow , hotweels ) . box ( yellow , puzzle ) . box ( red , dress )

Consider the following Prolog program:
box(yellow, hotweels). box(yellow, puzzle). box(red, dress). box(red, shoes). box(blue, book).
addressed_to(yellow, alex). addressed_to(blue, alex). addressed_to(red, becky).
addressed_to(green, chris).
gift(Person, Gift) :- addressed_to(Color, Person), box(Color, Gift).
no_gift(Person) :- addressed_to(Color, Person), not box(Color, Gift).
(a) What is the first value of X returned by the goal gift(alex, X)?
(b) Which person does not receive a gift? That is, what is the value of X returned by the goal
no_gift(X)?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!