Up

module Multi_map

: sig

Maps with mutliple bindings.

This is a map that allows multiple binding. Each key can have several values associated to it.

#
type ('k, 'v) t
include Core.Std.Sexpable.S2 with type ('a, 'b) t := ('a, 'b) t
#
val empty : ('k, 'v) t
#
val singleton : 'k -> 'v -> ('k, 'v) t
#
val is_empty : ('k, 'v) t -> bool
#
val add : key:'k -> data:'v -> ('k, 'v) t -> ('k, 'v) t
#
val find : ('k, 'v) t -> 'k -> 'v list

find m key returns all the elements that where added to key in m in the reverse order in which they where added. If no element where added an empty list is returned.

#
val remove : ('k, 'v) t -> 'k -> ('k, 'v) t

remove m key Remove all the values associated the key key in m

#
val set : key:'k -> data:'v list -> ('k, 'v) t -> ('k, 'v) t
#
val mem : ('k, 'v) t -> 'k -> bool

mem m key returns true if key has at last one value associated to it in m

#
val keys : ('k, 'v) t -> 'k list

Returns all the non-empty keys in m.

#
val iter : f:(key:'k -> data:'v -> unit) -> ('k, 'v) t -> unit
#
val map : f:('a -> 'b) -> ('k, 'a) t -> ('k, 'b) t
#
val mapi : f:(key:'k -> data:'a -> 'b) -> ('k, 'a) t -> ('k, 'b) t
#
val fold : f:(key:'k -> data:'v -> 'a -> 'a) -> ('k, 'v) t -> init:'a -> 'a
#
val filter : f:(key:'k -> data:'v -> bool) -> ('k, 'v) t -> ('k, 'v) t
#
val reduce : f:('v list -> 'r) -> ('k, 'v) t -> ('k, 'r) Core.Std.Map.Poly.t
end