cuts of backtracking
cutbacktrack(BTP)
cutbacktrack(BackTrackPoint) (i)
integer(BackTrackPoint) (i) A value obtained by getbacktrack.
Together with
getbacktrack
() this predicate
may be used to effect backtracking. Its effect is, that when backtracking takes place back to the
cutbacktrack() goal, the execution flow takes a short-cut back to the position where the
associated getbacktrack() goal was done.
Instead of using getbacktrack() and cutbacktrack() you may also use
set_cut
() and
cut
() to
achieve the same purpose. set_cut()/cut() are more comfortable in a way that you may use virtual
handle, but they work sufficiently slower.
repeat, getbacktrack(BTP), for(1,5,X), write(X), X = 3, cutbacktrack(BTP), fail.
This will cause the following output: 123123123 ...
A runtime error occurs if BackTrackPoint is invalid. However, misuse may crash the system.
prolog-process, client-server, object
! , set_cut , cut , getbacktrack