Question: please use Prolog to implement following function: this holds when As, Bs, and ABs are lists of the same length, and each element of ABs
please use Prolog to implement following function:

this holds when As, Bs, and ABs are lists of the same length, and each element of ABs is a term of the form A-B where A is the corresponding element of As and B is the corresponding element of Bs. This should work whenever at least one of the arguments is a proper list. Note that - is an infix operator here, but aside from syntax, A-B is an ordinary term whose functor is - and whose two arguments are A and B. For example: zip ([1,2,3,4], [a,b,c,d],L) should have only the solution 1-[1-a,2-b , 3-c,4-d]] zip (XX, [1-a,2-b , 3-c , 4-d]) should have only the solution ?-[1,2,3,4], Y=[a,b,c,d] zip( [1, 2, 3,4] ,Y, [1-a, 2-b, 3-c,4-d]) should have only the solution Y=[a,b,c,d] zip (X, [a,b,c,d] , [1-P, 2-Q, 3-R, 4-S] ) should have only the solution x-[1, 2, 3, 4]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
