Version: 1.5#118 (2000/4/19, 18:13:43 CEST)
This module includes predicates related to exceptions, which alter the normal flow of Prolog.
exceptions)exceptions)
catch(Goal,Error,Handler)
Executes Goal. If an exception is raised during its execution, Error is unified with the exception, and if the unification succeeds, the entire execution derived from Goal is aborted, and Handler is executed. The execution resumes with the continuation of the catch/3 call. For example, given the code
p(X) :- throw(error), display('---').
p(X) :- display(X).
the execution of "catch(p(0), E, display(E)), display(.), fail." results in the output "error.".
Meta-predicate with arguments: catch(goal,?,goal).
Usage 2: * ISO *
Error is any term.
(basic_props:term/1)
Goal is a term which represents a goal, i.e., an atom or a structure.
(basic_props:callable/1)
Handler is a term which represents a goal, i.e., an atom or a structure.
(basic_props:callable/1)
Error is any term.
(basic_props:term/1)
intercept(Goal,Error,Handler)
Executes Goal. If an exception is raised during its execution, Error is unified with the exception, and if the unification succeeds, Handler is executed and then the execution resumes after the predicate which produced the exception. Note the difference with builtin
catch/3, given the same code defined there, the execution of "intercept(p(0), E, display(E)), display(.), fail." results in the output "error---.0.".
Meta-predicate with arguments: intercept(goal,?,goal).
Usage 2:
Error is any term.
(basic_props:term/1)
Goal is a term which represents a goal, i.e., an atom or a structure.
(basic_props:callable/1)
Handler is a term which represents a goal, i.e., an atom or a structure.
(basic_props:callable/1)
Error is any term.
(basic_props:term/1)
throw(Ball)
Raises an error, throwing the exception Ball, to be caught by an ancestor
catch/3 or
intercept/3. The closest matching ancestor is chosen. Exceptions are also thrown by other builtins in case of error.
Usage 1: * ISO *
Ball is currently a term which is not a free variable.
(term_typing:nonvar/1)
Usage 2: * ISO *
Ball is currently a term which is not a free variable.
(term_typing:nonvar/1)
halt
Halt the system, exiting to the invoking shell.
halt(Code)
Halt the system, exiting to the invoking shell, returning exit code Code.
Usage 2: * ISO *
Code is an integer.
(basic_props:int/1)
abort
Abort the current execution.
Go to the first, previous, next, last section, table of contents.