Module Hashnlist


module Hashnlist: sig  end
Extends the functionality of hash tables to map keys to lists of values. Adding a (key, value) pair adds the value to the entry indexed by the key.
See also testing/test_hashnlist.ml for simple examples of how to use this module.


type ('a, 'b) t
The type of hash tables from type 'a to lists of type 'b.

val create : int -> ('a, 'b) t
create n creates a new hashnlist object of initial size n.
val clear : ('a, 'b) t -> unit
clear h removes all keys and values from the hashnlist h.
val add : ('a, 'b) t -> 'a -> 'b -> unit
add h k v adds value v to the entry indexed by k in the hashnlist h.
val remove : ('a, 'b) t -> 'a -> 'b -> unit
remove h k v removes value v from the entry indexed by k in the hashnlist h. Raises exception Not_found if entry is not registered; contrast with the standard Hash table.
val find : ('a, 'b) t -> 'a -> 'b list
find h k returns the list of values attached to the key k in the hashnlist h.
val indexlist : ('a, 'b) t -> 'a list
indexlist h returns a list of all the keys which have a non-empty list of values associated to them in the hashnlist h.
val mem : ('a, 'b) t -> 'a -> bool
mem h k return true if there is at least one value associated to the key k in h, or false otherwise.