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

dom(+Var, ?List)

List is the list of elements in the domain of Var.
A domain variable or an integer.
Term unifying with a list of integers.


If Var is a domain variable, List is unified with a sorted list of all elements in its domain. If Var is an integer, List is unified with a singleton list.

The predicates ::/2 and #::/2 can also be used to query the domain of a domain variable, however they yield a list of integer intervals, which is the direct domain representation (it is therefore also more efficient because no new structures have to be created).

Use this predicate with care, because it might expand a compact representation of large intervals into an explicit list of their elements. Unless an explicit list representation of the domain is really required, the predicates working on domains should be preferred.

Fail Conditions





(4) instantiation fault
Var is not a domain variable.


   [eclipse 9]: X::[1..3, 100..102], dom(X, List), X::I.
   List = [1, 2, 3, 100, 101, 102]
   X = X :: [1 .. 3, 100 .. 102]
   I = [1 .. 3, 100 .. 102]

See Also

:: / 2, #:: / 2, maxdomain / 2, mindomain / 2