---
name: "Repr"
section: "3o"
platform: "linux"
package: "ocaml"
version: "5.5.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Repr"
---

# Repr(3o)

Functions defined on the low-level representations of values.

## NAME

Repr - Functions defined on the low-level representations of values.

## Module

Module   Repr

## Documentation

Module **Repr**\
  :  **sig end**

Functions defined on the low-level representations of values.

**Since** 5.4

### 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** .
