Scryer Prolog documentation

Module si

:- use_module(library(si)).

Safe type tests.

"si" stands for "sufficiently instantiated". It can also be read as "safe inference", so possibly also other predicates are candidates for this library.

A safe type test:

  • throws an instantiation error if the argument is not sufficiently instantiated to make a sound decision

  • succeeds if the argument is of the specified type

  • fails otherwise.

For instance, atom_si(A) yields an instantiation error if A is a variable. This is logically sound, since in that case the argument is not sufficiently instantiated to make any decision.

The definitions are taken from Safer type tests in Prolog.

Examples:


?- chars_si(Cs).
   error(instantiation_error,list_si/1).
?- chars_si([h|Cs]).
   error(instantiation_error,list_si/1).
?- chars_si("hello").
   true.
?- chars_si(hello).
   false.

when_si(Condition, Goal).

Executes Goal when Condition becomes true. Throws an instantiation error if it can't decide.

atom_si/1

integer_si/1

atomic_si/1

list_si/1

character_si/1

term_si/1

chars_si/1

dif_si/2