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

?Vars #:: ?Range

Pure range constraint
Vars
Variable or number, or a list of variables or numbers
Range
Variable or Lo..Hi, where Lo and Hi are variables or numeric expressions

Description

This constraint suspends until its arguments are ground. It then succeeds iff all the elements of the list Vars are numbers within the range specified by Range.

The range must eventually be in the form Lo..Hi, where Lo and Hi are expressions evaluating to numbers. The type of these numbers is irrelevant.

Modules

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

Fail Conditions

Vars contains numbers that do not fall within Range.

Examples

    ?- X $:: 1 .. 5, X = 3.0.
    X = 3.0
    Yes (0.00s cpu)

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

    ?- X $:: 1.0 .. 5.0, X = 3.
    X = 3
    Yes (0.00s cpu)

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

See Also

:: / 2, #:: / 2, $:: / 3, integers / 1, reals / 1