Stateful Programming Despite the virtues of pure functional programming, there are times when you'd like to be able to update memory directly. To support such applications, ML includes refer- ences and arrays. References Think of a reference as a container for a value.
References are fully first-class values in their own right.
This means they can be embedded in data structures, passed as arguments or returned as func- tion results. Array bounds are checked at runtime. Ele- ments are indexed from 0. There is a similar datatype Vector which allows constant-time access but no update.