package fix

  1. Overview
  2. Docs

An implementation of persistent maps can be made to satisfy the interface of imperative maps. An imperative map is represented as a persistent map, wrapped within a reference cell.

Parameters

module M : sig ... end

Signature

type key = M.key

The type of keys.

type 'data t = 'data M.t ref

The type of association maps.

val create : unit -> 'data t

create() creates a fresh empty map.

val add : key -> 'data -> 'data t -> unit

add inserts a new entry or replaces an existing entry. The map is updated in place.

val find : key -> 'data t -> 'data

find raises Not_found if the key is not in the domain of the map.

val clear : 'data t -> unit

clear empties a map.

val iter : (key -> 'data -> unit) -> 'data t -> unit

iter iterates over all entries.

OCaml

Innovation. Community. Security.