Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

4th Edition

ISBN: 0619064625, 978-0619064624

More Books

Students also viewed these Databases questions

Question

2. What are your challenges in the creative process?

Answered: 1 week ago