[ library(suspend) | Reference Manual | Alphabetic Index ]
?Expr1 and ?Expr2
Both Expr1 and Expr2 arithmetically evaluate to 1
- Expr1
- A boolean expression
- Expr2
- A boolean expression
Description
Suspends until both Expr1 and Expr2 are ground, and then both arguments
are evaluated. Succeeds if both evaluate to 1.
Typically, the expressions contains reifiable constraints, in which case
a corresponding reified constraint is set up, and the expression is
replaced by the resulting boolean variable.
Modules
This predicate is sensitive to its module context (tool predicate, see @/2).
Fail Conditions
Expr1 or Expr2 do not both evaluate to 1
Exceptions
- (24) number expected
- Expr1 or Expr2 is not an arithmetic expression.
Examples
?- B and 1, B = 1.
B = 1
Yes (0.00s cpu)
?- B and 1, B = 0.
No (0.00s cpu)
% arguments are typically reifiable expressions:
?- X > 5 and X < 7, X = 7.
No (0.00s cpu)
% the previous example is equivalent to:
?- >(X,5,B1), <(X,7,B2), B1 and B2, X=7.
No (0.00s cpu)
% and/or/=>/neg are themselves reifiable:
?- X > 5 and neg(X < 7), X = 7.
X = 7
Yes (0.00s cpu)
See Also
and / 3, or / 2, => / 2, neg / 1, ic : and / 2, gfd : and / 2