Succeeds if X is an interval and Dom unifies with the domain of X; otherwise fails. Dom is a compound term with a functor specifying the type (real or integer) and the arguments specifying the bounds. If X has a domain of integer(0,1)
, Dom will be boolean. Examples:
?- range(X,[2,3]), domain(X,Dom).
Dom = real(2, 3),
X::real(2, 3).
?- X::integer(0,1),domain(X,Dom).
Dom = boolean,
X::boolean.
?- domain(X,Dom).
false.
Note: unlike range/2, domain/2 will not change X.