Question: 4. Use the append predicate to define a predicate just_before(x, y, z) that holds when x appears just before y as an element of list
4. Use the append predicate to define a predicate just_before(x, y, z) that holds when x appears just before y as an element of list z. So, for example,
?- just_before(3,4,[1,2,3,4,5,6]).
Yes
?- just_before(3,5,[1,2,3,4,5,6]).
No Hint: This can be done with one clause. Look at how elem2 is defined.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
