Question
(Logic programming PROLOG) Write, run, and test a predicate abc(L) which succeeds if list L contains (for any list element) an atom a, followed directly
(Logic programming PROLOG) Write, run, and test a predicate abc(L) which succeeds if list L contains (for any list element) an atom a, followed directly by an atom b, followed directly by an atom c; and which fails otherwise. For example, abc( [d,a,b,c,e,f] ) should succeed, and abc( [d,a,b,g,c,e,f] ) should fail. Show screen shots of code and 10 test queries below in PROLOG.
abc( [d,a,b,c,e,f] ). abc( [d,a,b,g,c,e,f] ). abc( [ ] ). abc( [a,a,a,b,c] ). abc( [b,a,c,b,a,b,a,c,b,c,a,a,b,b,c] ). abc( [a,b] ). abc( [a],[b],[c] ). abc( [ [a,b,c],b,a,c] ). abc( [b,a,a,a,b,a,c,b,c,a,a,b,c] ). abc( [abc,[a],c,b,a,b,a,c,b,c,a,a,b,b,c] ).
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 Started