Simple prolog program. Getting error: >/2: Arguments are not sufficiently instantiated
- by user1279812
I made a prolog program posAt(List1,P,List2) that tests whether the element at position P of List1 and List2 are equal:
posAt([X|Z],1,[Y|W]) :- X=Y.
posAt([Z|X],K,[W|Y]) :- K1, Kr is K - 1, posAt(X,Kr,Y).
When testing:
?- posAt([1,2,3],X,[a,2,b]).
I expected an output of X=2 but instead I got the following error: ERROR: /2: Arguments are not sufficiently instantiated
Why am I getting this error?