package term-tools

  1. Overview
  2. Docs
type key = int

The type of keys.

type 'a t

The type of maps polymorphic in their values.

val empty : unit -> 'a t

empty () is the empty map.

val is_empty : 'a t -> bool

is_empty m is true if and only if m is empty.

val find_opt : key -> 'a t -> 'a option

find_opt k m is Some v if k is bound to v in m, and None otherwise.

val add : key -> 'a -> 'a t -> 'a t

add k v m is the map that binds k to v in m. If k is already bound, the previous binding is shadowed.

val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool

equal eq m1 m2 is true if and only if m1 and m2 are equal according to eq.

val union : 'a t -> 'a t -> 'a t

union m1 m2 is the union of m1 and m2.

Raises Invalid_argument if m1 and m2 have overlapping domains.

val to_seq : 'a t -> (key * 'a) Seq.t

to_seq m produces the persistent sequence of elements of m in increasing key order.

val to_seq_keys : 'a t -> key Seq.t

of_seq_keys m is the sequence of keys of m

val of_seq : (key * 'a) Seq.t -> 'a t

of_seq s constructs a map from the elements of s.

OCaml

Innovation. Community. Security.