OCamlMutable record fields


Like most OCaml values, records are immutable by default. However, since OCaml also handles imperative programming, it provides a way to make individual fields mutable. Mutable fields can be modified in-place by assignment, rather than having to resort to usual functional techniques, such as functional update.

While introducing side-effects, mutable fields can result in an improved performance when used correctly.