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

?Vars &:: +Domain

All elements of Vars have a value in the domain Domain
variable or atomic value, list of them, or submatrix of them
domain name (atom) or list of domain elements


Constrains a variable, or a list or submatrix of variables, to be in the domain Domain. Domain must be the name of a previously declared domain (see domain/1), or a sub-domain, expressed as a list of values from a single domain. A domain variable can only be instantiated to values within its domain.

Note that, on the left hand side of &::/2, the atom [] is not interpreted as the empty list but as a potential domain element.


This predicate is sensitive to its module context (tool predicate, see @/2).


    ?- X &:: weekday.
    X = X{[mo, tu, we, th, fr, sa, su]}
    Yes (0.00s cpu)

    ?- [X,Y,we] &:: weekday.
    X = X{[mo, tu, we, th, fr, sa, su]}
    Y = Y{[mo, tu, we, th, fr, sa, su]}
    Yes (0.00s cpu)

    ?- dim(M,[3]), M[1..3] &:: weekday.
    M = [](_306{[mo, tu, we, th, fr, sa, su]}, ...)
    Yes (0.00s cpu)

    ?- [X,Y] &:: [we,fr,su].
    X = X{[we, fr, su]}
    Y = Y{[we, fr, su]}

    ?- X &:: [].
    No (0.00s cpu)

See Also

domain / 1, current_domain / 3, domain_index / 3