.TH "Map" 3o source: 2019-01-25 OCamldoc "OCaml library" .SH NAME Map \- Association tables over ordered types. .SH Module Module Map .SH Documentation .sp Module .BI "Map" : .B sig end .sp Association tables over ordered types\&. .sp This module implements applicative association tables, also known as finite maps or dictionaries, given a total ordering function over the keys\&. All operations over maps are purely applicative (no side\-effects)\&. The implementation uses balanced binary trees, and therefore searching and insertion take time logarithmic in the size of the map\&. .sp For instance: .B .B module IntPairs = .B struct .B type t = int * int .B let compare (x0,y0) (x1,y1) = .B match Pervasives\&.compare x0 x1 with .B 0 \-> Pervasives\&.compare y0 y1 .B | c \-> c .B end .B .B module PairsMap = Map\&.Make(IntPairs) .B .B let m = PairsMap\&.(empty |> add (0,1) "hello" |> add (1,0) "world") .B .sp This creates a new module .B PairsMap , with a new type .B \&'a PairsMap\&.t of maps from .B int * int to .B \&'a \&. In this example, .B m contains .B string values so its type is .B string PairsMap\&.t \&. .sp .sp .sp .I module type OrderedType = .B sig end .sp Input signature of the functor .B Map\&.Make \&. .sp .I module type S = .B sig end .sp Output signature of the functor .B Map\&.Make \&. .sp .I module Make : .B functor (Ord : OrderedType) -> sig end .sp Functor building an implementation of the map structure given a totally ordered type\&. .sp