Tutorial by Examples

An instantiation error is thrown if an argument is not sufficiently instantiated. Critically, an instantiation error cannot be replaced by silent failure: Failing in such cases would mean that there is no solution, whereas an instantiation error means that an instance of the argument may participat...
Prolog features exceptions, which are part of the Prolog ISO standard. An exception can be thrown with throw/1, and caught with catch/3. The ISO standard defines many cases in which errors must or may be thrown. The standardized exceptions are all of the form error(E,_), where E indicates the erro...
The predicate setup_call_cleanup/3, which is currently being considered for inclusion in the Prolog ISO standard and provided by an increasing number of implementations, lets us ensure that resources are correctly freed after an exception is thrown. A typical invocation is: setup_call_cleanup(open...
A type error occurs if an argument is not of the expected type. Examples of types are: integer atom list. If the predicate is of the expected type, but outside the expected domain, then a domain error is raised. For example, a domain error is admissible if an integer between 0 and 15 is exp...

Page 1 of 1