[ library(suspend) | The ECLiPSe Libraries | Reference Manual | Alphabetic Index ]

::(?Var, ?Range, ?Bool)

Reified range constraint with optional integrality constraint
Var
Variable or number
Range
Variable or Lo..Hi, where Lo and Hi are variables or numeric expressions
Bool
Variable, 0 or 1

Description

Reified version of ::/2, i.e. the truth value of the range constraint is reflected in the value of the 0/1 variable Bool.

This constraint suspends until its first two arguments are ground. It then unifies Bool according to the truth value of the corresponding ::/2 constraint.

Note: as opposed to ::/2, the first argument cannot be a list.

Modules

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

Examples

    ?- ::(X, 1 .. 5, B), X = 3.
    B = 1
    X = 3
    Yes (0.00s cpu)

    ?- ::(X, 1.0 .. 5.0, B), X = 3.0.
    B = 1
    X = 3.0
    Yes (0.00s cpu)

    % range violated
    ?- ::(X, 1 .. 5, B), X = 6.
    B = 0
    X = 6
    Yes (0.00s cpu)

    % integrality violated
    ?- ::(X, 1 .. 5, B), X = 3.0.
    B = 0
    X = 3.0
    Yes (0.00s cpu)
    

See Also

:: / 2