Next: List Processing, Previous: Comparison of Terms, Up: Terms [Contents][Index]
These testing predicates are used to determine various properties of the data objects, or apply constraints to the data objects.
Relations:
Succeed if
Term
is a non-variable of typeType
.
type : rel(??term, !typeE(_))
Example:
| ?? type(a, atomic). yes | ?? type(a, int). no
Succeed if
Term
is ground.
ground: rel(??term)
Succeed if
Term
is of typeType
andType
is a finite type.
isa: (?term, !typeE(_))
Example: For this example we assume the following type declarations.
name ::= "Alice" | "Bob" | "Carol" status ::= good(name) | bad(name)| ?? isa(X, status). X = good("Alice") ... X = good("Bob") ... X = good("Carol") ... X = bad("Alice") ... X = bad("Bob") .. X = bad("Carol") | ?? isa(good("Bob"), status). yes | ?? isa(2, nat). Error: nat is not a finite type in isa(2, nat) of isa(2, nat)
Succeed if
Term
is atomic or a compound term with a ground functor.
template :rel(??term)