Question: Do not use any pre - defined Prolog list predicates in answering this question. Define a Prolog predicate blend ( X , Y , Z

Do not use any pre-defined Prolog list predicates in answering this question.
Define a Prolog predicate blend(X,Y,Z) which is true only if Z is a list that results from
selecting elements from lists X and Y in strict alternation, as shown in these examples: blend([1,2,3],
[101,201],[1,101,2,201,3]) is true. blend([1,2],[101,201,301],[1,101,2,201,301]) is
true. blend([1,2],[],[1,2]) is true. blend([1,2],[101,201,301,401], Z) results in Z =[1,101,2,201,301,401].

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 Programming Questions!