[ library(suspend) | Reference Manual | Alphabetic Index ]
?Expr1 or ?Expr2
At least one of Expr1 or 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 at least one evaluates 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
Neither Expr1 nor Expr2 evaluates to 1
Exceptions
- (24) number expected
- Expr1 or Expr2 is not an arithmetic expression.
Examples
?- B or 1, B = 0.
B = 0
Yes (0.00s cpu)
?- B or 0, B = 0.
No (0.00s cpu)
% arguments are typically reifiable expressions:
?- X > 7 or X < 5, X = 7.
No (0.00s cpu)
% the previous example is equivalent to:
?- >(X,7,B1), <(X,5,B2), B1 or B2, X=7.
No (0.00s cpu)
% and/or/=>/neg are themselves reifiable:
?- X > 7 or neg(X < 5), X = 7.
X = 7
Yes (0.00s cpu)
See Also
or / 3, and / 2, => / 2, neg / 1, ic : or / 2, gfd : or / 2