[ Arithmetic | Reference Manual | Alphabetic Index ]
eval(+Expression, -Result)
Used to evaluate eval/1 terms in arithmetic expressions.
- Expression
- An arithmetic expression.
- Result
- A variable or a number.
Description
This is one of the predicates used by the ECLiPSe compiler to expand
arithmetic expressions. If an expression contains a subexpression that
is not known at compile time, it must be wrapped in eval/1, e.g.
X is eval(Expr)+1
This will be compiled into the sequence
eval(Expr,T1), +(T1,1,X)
and eval/2 will interpret the expression Expr at runtime.
Modes and Determinism
Modules
This predicate is sensitive to its module context (tool predicate, see @/2).
Exceptions
- (4) instantiation fault
- Expression is uninstantiated.
- (21) undefined arithmetic expression
- An evaluation predicate in the expression is not defined.
- (24) number expected
- Expression is not a valid arithmetic expression.
Examples
See Also
is / 2