package containers

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type 'b t

Index that maps strings to values of type 'b. Internally it is based on a trie. A string can only map to one value.

val empty : 'b t

Empty index

val is_empty : _ t -> bool
val add : 'b t -> string_ -> 'b -> 'b t

Add a pair string/value to the index. If a value was already present for this string it is replaced.

val cardinal : _ t -> int

Number of bindings

val remove : 'b t -> string_ -> 'b t

Remove a string (and its associated value, if any) from the index.

val retrieve : limit:int -> 'b t -> string_ -> 'b klist

Lazy list of objects associated to strings close to the query string

val of_list : (string_ * 'b) list -> 'b t

Build an index from a list of pairs of strings and values

val to_list : 'b t -> (string_ * 'b) list

Extract a list of pairs from an index

val add_seq : 'a t -> (string_ * 'a) sequence -> 'a t
  • since 0.14
val of_seq : (string_ * 'a) sequence -> 'a t
  • since 0.14
val to_seq : 'a t -> (string_ * 'a) sequence
  • since 0.14
val add_gen : 'a t -> (string_ * 'a) gen -> 'a t
  • since 0.14
val of_gen : (string_ * 'a) gen -> 'a t
  • since 0.14
val to_gen : 'a t -> (string_ * 'a) gen
  • since 0.14
val fold : ('a -> string_ -> 'b -> 'a) -> 'a -> 'b t -> 'a

Fold over the stored pairs string/value

val iter : (string_ -> 'b -> unit) -> 'b t -> unit

Iterate on the pairs

val to_klist : 'b t -> (string_ * 'b) klist

Conversion to an iterator