UrefUnion-find with union by rank and path compression
This is an implementation of Tarjan's union-find data structure using generics. The interface is analagous to standard references, with the addition of a union operation which makes two references indistinguishable.
val uref : 'a -> 'a urefCreate a new uref
val deref : 'a uref -> 'aExtract the contents of this reference
val update : ('a uref * 'a) -> unitUpdate the value stored in this reference
unify f (p,q) unifies references p and q, making them indistinguishable. The contents of the reference are the result of f