Module CCBijection.Make

Parameters

Signature

type t
type left = L.t
type right = R.t
val empty : t
val is_empty : t ‑> bool
val equal : t ‑> t ‑> bool
val compare : t ‑> t ‑> int
val add : left ‑> right ‑> t ‑> t

Add left and right correspondence to bijection such that left and right are unique in their respective sets and only correspond to each other.

val cardinal : t ‑> int

Number of bindings. O(n) time.

val mem : left ‑> right ‑> t ‑> bool

Check both sides for key membership.

val mem_left : left ‑> t ‑> bool

Check for membership of correspondence using left key.

val mem_right : right ‑> t ‑> bool

Check for membership of correspondence using right key.

val find_left : left ‑> t ‑> right
val find_right : right ‑> t ‑> left
val remove : left ‑> right ‑> t ‑> t

Remove the left, right binding if it exists. Return the same bijection otherwise.

val remove_left : left ‑> t ‑> t

Remove the binding with left key if it exists. Return the same bijection otherwise.

val remove_right : right ‑> t ‑> t

Remove the binding with right key if it exists. Return the same bijection otherwise.

val list_left : t ‑> (left * right) list

Return the bindings as a list of (left, right) values.

val list_right : t ‑> (right * left) list

Return the bindings as a list of (right, left) values.

val add_seq : (left * right) sequence ‑> t ‑> t
val of_seq : (left * right) sequence ‑> t
val to_seq : t ‑> (left * right) sequence
val add_list : (left * right) list ‑> t ‑> t
val of_list : (left * right) list ‑> t
val to_list : t ‑> (left * right) list