Question: Write a prolog program for substitute(X,Y,L1,L2), where L2 is the result of substituting Y for all occurrences of X in L1, e.g., substitute(a,x,[a,b,a,c],[x,b,x,c]) is true,

Write a prolog program for substitute(X,Y,L1,L2), where L2 is the result of substituting Y for all occurrences of X in L1, e.g., substitute(a,x,[a,b,a,c],[x,b,x,c]) is true, whereas substitute (a, x, [a,b, a, c] , [a,b ,x, c] ) is false.

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