Question
. sublist/2 Write a Prolog predicate sublist(X,Y) that is true if list X is a sublist of list Y. A sublist is defined as the
. sublist/2
Write a Prolog predicate sublist(X,Y) that is true if list X is a sublist of list Y. A
sublist is defined as the original list, in the same order, but in which some elements
may have been removed. For instance (user input is in bold):
?- sublist([a,b],[a,e,b,d,s,e]).
Yes
?- sublist([a,b],[a,e,e,f]).
No
?- sublist([a,b],[b,a]).
No
?- sublist([],[a,e,e,f]).
Yes
?- sublist([a],[]).
No
?- sublist(X,[a,b,c]).
X = [] ;
X = [a] ;
X = [a, b] ;
X = [a, b, c] ;
X = [a, c] ;
X = [b] ;
X = [b, c] ;
X = [c] ;
No
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get StartedRecommended Textbook for
Introduction To Mathematical Statistics And Its Applications
Authors: Richard J. Larsen, Morris L. Marx
5th Edition
321693949, 978-0321694027, 321694023, 978-0321693945
Students also viewed these Programming questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App