[ library(gfd) | Reference Manual | Alphabetic Index ]

get_domain(?Var, -Domain)

Returns a ground representation of the current GFD domain of a variable.
Var
A domain variable or an integer.
Domain
A ground representation of the domain of Var.

Description

If Var is an integer, Domain will be unified with a singleton list with that integer.

If Var is an GFD domain variable with no holes in its domain, Domain will be unified with the term Lo..Hi where Lo and Hi are integers corresponding to the current lower and upper bounds of Var, respectively.

If Var is an GFD domain variable with holes in its domain, Domain will be unified with an ordered list of integers and/or terms Lo..Hi where Lo and Hi are integers; in this case the elements of the domain of Var are exactly those integers appearing directly in the list or falling within any of the intervals Lo..Hi.

Modes and Determinism

Fail Conditions

The initial value of Domain fails to unify with the returned value.

Exceptions

(5) type error
Var is neither an IC variable or number.

Examples

[eclipse 8]: X :: [1..5,10], get_domain(X, D).

X = X{[1 .. 5, 10]}
D = [1 .. 5, 10]

See Also

get_domain_as_list / 2, get_bounds / 3