[ Arithmetic | Reference Manual | Alphabetic Index ]
# max(+Vector, -Result)

Evaluates the the arithmetic expressions in Vector and unifies their maximum
with Result.
*Vector*
- A list, array or vector expression.
*Result*
- Output: number.

## Description

This predicate is used by the ECLiPSe compiler to expand evaluable
arithmetic expressions. So the call to max(Vector, Result) is
equivalent to
Result is max(Vector)

which should be preferred.
Vector must be a non-empty list, array or collection expression
(as accepted by eval_to_list/2). The elements of Vector must
be numbers, and Result is the maximum of these numbers (converted
to the widest type of the vector elements).

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 *
- Vector is insufficiently instantiated (non-coroutining mode only).
*(5) type error *
- Vecotr is not a list, array, or vector expression.

## Examples

Success:
X is max([1,2,3]). % gives X = 3
X is max([1,2.0,3]). % gives X = 3.0
X is max([](1,2,3)). % gives X = 3
A=[](4,5,6,7), X is max(A[2..3]). % gives X = 6
Error:
X is max([]). % type error

## See Also

is / 2, max / 3, min / 2, eval_to_list / 2