%% Basic predicates (do not worry about the definitions at this stage):
%% Linear precedence:
lp([],Z,Z).
lp([A|X],Y,[A|Z]) :- lp(X,Y,Z).
%% Backtrack (go back and take the next choice):
backtrack :- fail.
%% Carry on after backtracking:
perform(X) :- call(X),!,fail.
perform(_).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%