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


All elements of List are different
List of domain variables or atomic values


Constrains all list elements to be different atomic values. At call time, the list elements must already have domains or be instantiated.

Operationally, the predicate delays until list elements become instatiated, and removes the corresponding values from the domains of the other list elements.


    ?- [X, Y, Z] &:: [a,b,c,d], alldifferent([X,Y,Z]), X = a.
    X = a
    Y = Y{[b, c, d]}
    Z = Z{[b, c, d]}
    There are 2 delayed goals.
    Yes (0.00s cpu)

    ?- X &:: [a,b,c], alldifferent([a,b,X]).
    X = c
    Yes (0.00s cpu)

See Also

&\= / 2