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

#::(?Vars, ?Range, ?Bool)

Reified range constraint combined with integrality constraint
Vars
Variable or integer, or a list of variables or integers
Range
Variable or Lo..Hi, where Lo and Hi are variables or integer 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).

Exceptions

(5) type error
Range contains non-integers.

Examples

    ?- #::(X, 1 .. 5, B), X = 3.
    B = 1
    X = 3
    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