jon.recoil.org

Module Make.Lmap

type key = t
type +'a t
val empty : 'a Lmap.t
val is_empty : 'a Lmap.t -> bool
val add : Lmap.key -> 'a -> 'a Lmap.t -> 'a Lmap.t

The key should not already exist in the map; this is not checked.

val singleton : Lmap.key -> 'a -> 'a Lmap.t
val disjoint_union : 'a Lmap.t -> 'a Lmap.t -> 'a Lmap.t

Unlike disjoint_union on maps, the disjointness is not checked.

val disjoint_union_many : 'a Lmap.t list -> 'a Lmap.t

The given maps must be pairwise disjoint, which is not checked.

val iter : (Lmap.key -> 'a -> unit) -> 'a Lmap.t -> unit
val fold : (Lmap.key -> 'a -> 'b -> 'b) -> 'a Lmap.t -> 'b -> 'b
val fold_left_map : ('a -> Lmap.key -> 'b -> 'a * 'c) -> 'a -> 'b Lmap.t -> 'a * 'c Lmap.t

Simultaneously map over the elements and accumulate a value. The arguments are ordered so as to make the order preservation as explicit as possible (the accumulator is produced from the values _before_ the key and value being passed).

val filter : (Lmap.key -> 'a -> bool) -> 'a Lmap.t -> 'a Lmap.t
val keys : _ Lmap.t -> Lmap.key list
val data : 'a Lmap.t -> 'a list
val bindings : 'a Lmap.t -> (Lmap.key * 'a) list
val of_list : (Lmap.key * 'a) list -> 'a Lmap.t

Keys in the list must be distinct, which is not checked.

val find : Lmap.key -> 'a Lmap.t -> 'a
val find_opt : Lmap.key -> 'a Lmap.t -> 'a option
val get_singleton : 'a Lmap.t -> (Lmap.key * 'a) option
val get_singleton_exn : 'a Lmap.t -> Lmap.key * 'a
val map : ('a -> 'b) -> 'a Lmap.t -> 'b Lmap.t
val mapi : (Lmap.key -> 'a -> 'b) -> 'a Lmap.t -> 'b Lmap.t
val map_sharing : ('a -> 'a) -> 'a Lmap.t -> 'a Lmap.t
val filter_map : (Lmap.key -> 'a -> 'b option) -> 'a Lmap.t -> 'b Lmap.t
val to_seq : 'a Lmap.t -> (Lmap.key * 'a) Stdlib.Seq.t
val for_all_with_fixed_arg : (Lmap.key -> 'a -> 'b -> bool) -> 'a Lmap.t -> 'b -> bool
val exists : (Lmap.key -> 'a -> bool) -> 'a Lmap.t -> bool
val choose : 'a Lmap.t -> Lmap.key * 'a

Returns an unspecified binding from the map

val add_seq : (Lmap.key * 'a) Stdlib.Seq.t -> 'a Lmap.t -> 'a Lmap.t

Keys in the sequence must be distinct from each other and from keys already in the map; neither of these conditions is checked.

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

Keys in the sequence must be distinct, which is not checked.

val print : (Stdlib.Format.formatter -> 'a -> unit) -> Stdlib.Format.formatter -> 'a Lmap.t -> unit
val invariant : 'a Lmap.t -> unit

Check that there are no duplicates in the list, calling Misc.fatal_errorf if a duplicate is found.