[ Arithmetic | Reference Manual | Alphabetic Index ]

max(+ExprList, -Result)

Evaluates the the arithmetic expressions in ExprList and unifies their maximum with Result.
ExprList
A list of arithmetic expressions.
Result
A variable or number.

Description

This predicate is used by the ECLiPSe compiler to expand evaluable arithmetic expressions. So the call to max(ExprList, Result) is equivalent to
    Result is max(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

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

Exceptions

(4) instantiation fault
ExprList is a partial list (non-coroutining mode only).
(5) type error
ExprList is not a proper list.

Examples

Success:
      X is max([1,2,3]).    % gives X = 3
      X is max([1,2.0,3]).  % gives X = 3.0

See Also

is / 2, max / 3, min / 2