Merge pull request #1706 from triska/si_doc
DOC: convert library(si) documentation to DocLog format
This commit is contained in:
@@ -1,28 +1,36 @@
|
|||||||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
|
|
||||||
Safe type tests
|
/** Safe type tests.
|
||||||
===============
|
|
||||||
|
|
||||||
"si" stands for "sufficiently instantiated".
|
"si" stands for "sufficiently instantiated". It can also be read as
|
||||||
|
"safe inference", so possibly also other predicates are candidates
|
||||||
|
for this library.
|
||||||
|
|
||||||
These predicates:
|
A safe type test:
|
||||||
|
|
||||||
- throw instantiation errors if the argument is
|
- throws an *instantiation error* if the argument is
|
||||||
not sufficiently instantiated to make a sound decision
|
not sufficiently instantiated to make a sound decision
|
||||||
- succeed if the argument is of the specified type
|
- *succeeds* if the argument is of the specified type
|
||||||
- fail otherwise.
|
- *fails* otherwise.
|
||||||
|
|
||||||
For instance, atom_si(A) yields an *instantiation error* if A is a
|
For instance, `atom_si(A)` yields an *instantiation error* if `A` is a
|
||||||
variable. This is logically sound, since in that case the argument
|
variable. This is logically sound, since in that case the argument
|
||||||
is not sufficiently instantiated to make any decision.
|
is not sufficiently instantiated to make any decision.
|
||||||
|
|
||||||
The definitions are taken from:
|
The definitions are taken from [Safer type tests in Prolog](https://stackoverflow.com/questions/27306453/safer-type-tests-in-prolog).
|
||||||
|
|
||||||
https://stackoverflow.com/questions/27306453/safer-type-tests-in-prolog
|
Examples:
|
||||||
|
|
||||||
"si" can also be read as "safe inference", so possibly also other
|
```
|
||||||
predicates are candidates for this library.
|
?- 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.
|
||||||
|
```
|
||||||
|
*/
|
||||||
|
|
||||||
:- module(si, [atom_si/1,
|
:- module(si, [atom_si/1,
|
||||||
integer_si/1,
|
integer_si/1,
|
||||||
|
|||||||
Reference in New Issue
Block a user