Why do we use '!' in prolog
This is the code that i am trying to understand. co(X) :- co(X,[],L). co([],A,A):- write(A). co([X|Xs], A, L) :- p(X-Z,A,R), !, Z1 is Z+1, co(Xs, [X-Z1|R], L). co([X|Xs], A, L) :- co(Xs, [X-1|A], L). p(X-Y,[X-Y|R],R):- !. p(X,[H|Y], [H|Z]) :- p(X,Y,Z). What is the use of '!' and predicate p(,,) in the above code. OR Can anybody just add comments in every step of the above code so that i can able to understand . Thanks. mat Beginners tend to use !/0 because they are not aware of its negative consequences. This is because most Prolog textbooks that are popular among beginners are quite bad and