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

?X &= ?Y

X is the same atomic value as Y
X
Variable or atomic value
Y
Variable or atomic value

Description

Constrains X and Y to be the same. This is very similar to unifying X and Y, except in the case where X and Y are both variables. While unification turns the two variables into one, this constraint preserves the separate variables but constrains them to be equal.

Examples

    ?- X &:: [red,green,blue], X &= red.
    X = red
    Yes (0.00s cpu)

    ?- X &:: [red,green,blue], X &= yellow.
    No (0.00s cpu)

    ?- [X, Y] &:: [red,green,blue], X &= Y.
    X = X{[blue, green, red]}
    Y = Y{[blue, green, red]}
    There is 1 delayed goal.
    Yes (0.00s cpu)

    ?- X &:: [red,green,blue], X &= Y.
    X = X{[blue, green, red]}
    Y = Y{[blue, green, red]}
    There is 1 delayed goal.
    Yes (0.00s cpu)

    ?- X &:: [red,green,blue], Y &:: [blue,yellow,green], X &= Y.
    X = X{[blue, green]}
    Y = Y{[blue, green]}
    There is 1 delayed goal.
    Yes (0.00s cpu)

    ?- X &:: [red, green, blue], Y &:: [blue, yellow, brown], X &= Y.
    X = blue
    Y = blue
    Yes (0.00s cpu)

    ?- red &= red.
    Yes (0.00s cpu)

    ?- X &= red.
    X = red
    Yes (0.00s cpu)
    

See Also

&= / 3, &\= / 2