package containers-data

  1. Overview
  2. Docs
type t
type left
type right
val empty : t
val is_empty : t -> bool
val add : t -> left -> right -> t

Add a binding (left,right).

val remove : t -> left -> right -> t

Remove a specific binding.

val cardinal_left : t -> int

Number of distinct left keys.

val cardinal_right : t -> int

Number of distinct right keys.

val remove_left : t -> left -> t

Remove all bindings for the left key.

val remove_right : t -> right -> t

Remove all bindings for the right key.

val mem_left : t -> left -> bool

Is the left key present in at least one pair?

val mem_right : t -> right -> bool

Is the right key present in at least one pair?

val find_left : t -> left -> right list

List of values for this given left-key.

val find_left_iter : t -> left -> right iter

Iterate on bindings for this given left-key.

  • since 3.13
val find_right : t -> right -> left list

List of values for this given right-key.

val find_right_iter : t -> right -> left iter

Iterate on bindings for this given left-key.

  • since 3.13
val find1_left : t -> left -> right option

Like find_left but returns at most one value.

val find1_right : t -> right -> left option

Like find_right but returns at most one value.

val fold : ('a -> left -> right -> 'a) -> 'a -> t -> 'a

Fold on pairs.

val pairs : t -> (left * right) iter

Iterate on pairs.

val add_pairs : t -> (left * right) iter -> t

Add pairs.

val iter_left : t -> left iter
val iter_right : t -> right iter
OCaml

Innovation. Community. Security.