[ library(suspend) | Reference Manual | Alphabetic Index ]
?Vars #:: ?Range
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
Description
This constraint suspends until its arguments are ground. It then succeeds
iff all the elements of the list Vars are integers within the range
specified by Range.
The range must eventually be in the form Lo..Hi, where Lo and Hi are
expressions evaluating to integers.
Modules
This predicate is sensitive to its module context (tool predicate, see @/2).
Fail Conditions
Vars contains non-integers or integers that do not fall within Range.
Exceptions
- (5) type error
- Range contains non-integers.
Examples
?- X #:: 1 .. 5, X = 3.
X = 3
Yes (0.00s cpu)
?- X #:: 1 .. 5, X = 6.
No (0.00s cpu)
?- X #:: 1 .. 5, X = 3.0.
No (0.00s cpu)
See Also
$:: / 2, :: / 2, #:: / 3, integers / 1, reals / 1