Control predicates

X ; Y
X or Y. Try X first; if it fails (possibly after being backtracked into), try Y.

(X -> Y)
If X, then try Y, otherwise fail. Y will not be backtracked into.

(X -> Y ; Z)
If X, then try Y, else try Z. X will not be backtracked into.

not X
(Sometimes written \+X or not(X)) Succeed only when X fails.

true
Succeed once, but fail when backtracked into.

repeat
Always succeed, even when backtracked into.

fail
Never succeed.

!
(Pronounced ``cut".) Acts like true, but cannot be backtracked past, and prevents any other clauses of the predicate it occurs in from being tried.

abort
Return immediately to the top-level Prolog prompt.

Previous page
Table of contents
Next page

Copyright © 1995 by David Matuszek
All rights reserved.
Last updated July 15, 1995