Question: Lambda Calculus and Functional Programming Consider the following Prolog program: p(X): - X=f(Y), g(x). p(x):- X=g(V), g(x). 9(X):- X=g(a). q(X): - X=g(b). Given the following
Consider the following Prolog program: p(X): - X=f(Y), g(x). p(x):- X=g(V), g(x). 9(X):- X=g(a). q(X): - X=g(b). Given the following query: ?- P(Z). How many times will Prolog need to backtrack before it finds a solution? 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
