Manipulating a potentially cyclic graph structure. Building a histogram of values or doing a bin sort. Recording global state. To support such applications, ML includes references and arrays .
References Think of a reference as a container for a value.
This means they can be embedded in data structures, passed as arguments or returned as function results. Array bounds are checked at runtime. Elements are indexed from 0. There is a similar datatype Vector which allows constant-time access but no update. We can simulate the behavior of an n -element state at the cost of a factor of just .