I'm very new to prolog. I am trying to implement the predicate occurs(Variable, Term) that succeeds if the prolog variable Variable
occurs in the prolog term Term, and fails otherwise.
occurs(Variable,Term) :-
Term =.. List.
occurs(Variable, List).
occurs(Variable,[_|L]) :-
occurs(Variable,L).
I tried converting Term into list and then comparing, it always returns true.
any kind of help would be appreciated.
ground/1which checks if some predicate doesn't contain vars - Anton Danilov