# Module Stdlib.Repr

    module Repr: Repr

## Physical comparison

    val phys_equal : 'a -> 'a -> bool

`phys_equal e1 e2` tests for physical equality of `e1` and `e2`. On mutable types such as references, arrays, byte sequences, records with mutable fields and objects with mutable instance variables, `phys_equal e1 e2` is true if and only if physical modification of `e1` also affects `e2`. On non-mutable types, the behavior of `phys_equal` is implementation-dependent; however, it is guaranteed that `phys_equal e1 e2` implies `compare e1 e2 = 0`.

## Polymorphic comparison

    val equal : 'a -> 'a -> bool

`equal e1 e2` tests for structural equality of `e1` and `e2`. Mutable structures (e.g. references and arrays) are equal if and only if their current contents are structurally equal, even if the two mutable objects are not the same physical object. Equality between functional values raises `Invalid_argument`. Equality between cyclic data structures may not terminate.

    val compare : 'a -> 'a -> int

`compare x y` returns `0` if `x` is equal to `y`, a negative integer if `x` is less than `y`, and a positive integer if `x` is greater than `y`. The ordering implemented by `compare` is compatible with the comparison predicates `(=)`, `(<)` and `(>)`, as well as the `equal` function defined above, with one difference on the treatment of the float value `nan`. Namely, the comparison predicates treat `nan` as different from any other float value, including itself; while `compare` treats `nan` as equal to itself and less than any other float value. This treatment of `nan` ensures that `compare` defines a total ordering relation.

`compare` applied to functional values may raise `Invalid_argument`. `compare` applied to cyclic structures may not terminate.

The `compare` function can be used as the comparison function required by the `Set.Make` and `Map.Make` functors, as well as the `List.sort` and `Array.sort` functions.

    val min : 'a -> 'a -> 'a

Return the smaller of the two arguments. The result is unspecified if one of the arguments contains the float value `nan`.

    val max : 'a -> 'a -> 'a

Return the greater of the two arguments. The result is unspecified if one of the arguments contains the float value `nan`.