The following Prolog code defines a predicate P. (Remember that uppercase terms are variables, not constants, in Prolog.)
P(X,[X|Y]).
P(X,[Y|Z]) :- P(X,Z).
-
Show proof trees and solutions for the queries P(A,[1,2,3]) and P(2,[1,A,3]).
-
What standard list operation does P represent?
Answer
Improve This Solution
View Answer