Question: Please answer question in regaurd to programming language prolog: Consider this definition of member / 2 , which is true when a list contains a

Please answer question in regaurd to programming language prolog: Consider this definition of member/2, which is true when a list contains a particular element.
member(x,[x]).
member(x,[|L]) :- member (x,L).
Consider the two queries below. Why do they have different behavior?
?-L=[1,2,3,4], member (3,L).
?- member(3,L),L=[1,2,3,4].
In the first query, member(3, L) will find infinitely many lists containing 3, but all except for one will be rejected
In the second query, member(3, L) will find infinitely many lists containing 3, but all except for one will be rejected
These queries will have the same behavior
Both queries have no defined behavior, and all things are possible
 Please answer question in regaurd to programming language prolog: Consider this

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!