cuts of backtracking
INCLUDE 'prolib.h' cut(handle)
cut(cut_point) (i)
handle(cut_point) (i) Handle associated with set_cut.
Together with set_cut () this predicate
may be used to effect backtracking. Its effect is, that when backtracking takes
place back to the cut() goal, the execution flow takes a short-cut back to the
position where the associated set_cut
() goal was done. Instead of using set_cut
() and cut() you may also use getbacktrack
() and cutbacktrack () to achieve
the same purpose. Getbacktrack()/Cutbacktrack() works faster, on the other hand
you cannot use virtual handles.
NOTE: If you cut back over a set_cut goal, the associated handle is not cleared. You thus might
be able to use it in the wrong place, causing the system to crash. This problem will be fixed
soon.
repeat, set_cut(start), for(1,5,X), write(X), X = 3, cut(start), fail.
This will cause the following output:
123123123 ...
A runtime error occurs if the Handle was not initialised by set_cut . Misuse my crash the system.
prolog-process, client-server, object
! , set_cut , getbacktrack , cutbacktrack