[ Arithmetic | Reference Manual | Alphabetic Index ]
Evaluates the the arithmetic expressions in ExprList and unifies their sum
- A list of arithmetic expressions.
- A variable or number.
This predicate is used by the ECLiPSe compiler to expand evaluable
arithmetic expressions. So the call to sum(ExprList, Result) is
Result is sum(ExprList)
which should be preferred.
In coroutining mode, if the list is only partly instantiated, the
predicate delays until the list is complete.
Modes and Determinism
This predicate is sensitive to its module context (tool predicate, see @/2).
- (4) instantiation fault
- ExprList is a partial list (non-coroutining mode only).
- (5) type error
- ExprList is not a proper list.
X is sum([1,2,3]). % gives X = 6
is / 2, + / 3