I'm new to prolog and I'm trying to write a predicate that returns "Yes" if two train stations are on the same line.
line(1,[a,b,c,d,e]);
line(2,[b,g,f,e,i,h]);
line(3,[l,m,g,n,f,o,p,q,i,j]);
same_line(X,Y):-
line(_,L),
member(X,L),
member(Y,L).
Example: ?- same_line(n,j). Yes
However, I get this error in WIN-PROLOG when compiling: ! Error 67 : Predicate Protected
What am I doing wrong?
;
) at the end of yourline
assertions? They should be periods (.
). – lurker