package unionFind

  1. Overview
  2. Docs
Implementations of the union-find data structure

Install

Dune Dependency

Authors

Maintainers

Sources

archive.tar.gz
md5=d7cc5d5e1b2418b0e00053bc233b9454
sha512=8f99e5db73038faf5f0efb49079a653574e7291838eabbdfcb2887e6757bafce890cd3047e9d076bb1e2165463ad00ce38126c4570e158061ccfe3e1e54c0445

doc/unionFind/UnionFind/module-type-STORE/index.html

Module type UnionFind.STORESource

The signature STORE describes an implementation of first-class stores.

type 'a store

A store can be thought of as a region of memory in which objects, known as references, can be dynamically allocated, read, and written. Stores are homogeneous: all references in a store of type 'a store have the content type, namely 'a. In general, a store may be persistent or mutable, depending on which data structure is used to implement it.

val new_store : unit -> 'a store

new_store() creates an empty store.

type 'a rref

A reference of type 'a rref can be thought of as (a pointer to) an object that exists in some store.

val make : 'a store -> 'a -> 'a store * 'a rref

make s v creates a fresh reference in the store s and sets its content to v. It returns a pair of an updated store and the newly-created reference.

val get : 'a store -> 'a rref -> 'a store * 'a

get s x reads the current content of the reference x in the store s. It returns a pair of a possibly-updated store and the current content of the reference.

val set : 'a store -> 'a rref -> 'a -> 'a store

set s x v updates the store s so as to set the content of the reference x to v. It returns an updated store.

val eq : 'a store -> 'a rref -> 'a rref -> 'a store * bool

eq s x y determines whether the references x and y are the same reference. It returns a pair of a possibly-updated store and a Boolean result. The references x and y must belong to the store s.

OCaml

Innovation. Community. Security.