I need to write a predicate in Prolog that given a list that return false if there are 2 consecutive '/', otherwise it returns true. This is what I've done so far, it works only in certain cases. For what I can see it works correclty only if the list has an even number of elements.
t([]) :- !.
t([X, Y | Xs]) :-
X \= '/',
Y \= '/',
!,
t(Xs).
t([X, Y | Xs]) :-
X \= Y,
t(Xs).
Could you please help me?
Thank you in advance.