← Back to team overview

marionnet-dev team mailing list archive

[Branch ~marionnet-drivers/ocamlbricks/trunk] Rev 311: Added the data structure of multi-maps, i.e. maps x->y where x may be associated to zero or sever...

 

------------------------------------------------------------
revno: 311
committer: Jean-Vincent Loddo <loddo@xxxxxxxxxxxxxxxxxxxx>
branch nick: ocamlbricks
timestamp: Sat 2012-03-17 12:04:10 +0100
message:
  Added the data structure of multi-maps, i.e. maps x->y where x may be associated to zero or several y. They are simply implemented as maps of sets, with the condition that a multimap with a value x associated to the empty set, is equivalent to a multimap where x is unbound. Multimap have the following output signature (S) :
  
  module type S =
     sig
        type key
        type elt
        type elt_set
  
        type t
        val empty         : t
        val is_empty      : t -> bool
        val add           : key -> elt -> t -> t
        val find          : key -> t -> elt_set
        val find_list     : ?sort:unit -> key -> t -> elt list
        val remove_key    : key -> t -> t
        val remove        : key -> elt -> t -> t
        val mem_key       : key -> t -> bool
        val mem           : key -> elt -> t -> bool
        val iter_key      : (key -> elt_set -> unit) -> t -> unit
        val iter          : (key -> elt -> unit) -> t -> unit
        val fold_key      : (key -> elt_set -> 'b -> 'b) -> t -> 'b -> 'b
        val fold          : (key -> elt -> 'b -> 'b) -> t -> 'b -> 'b
        val compare       : t -> t -> int
        val equal         : t -> t -> bool
  
        (* Extra functions: *)
  
        val filter_key    : (key -> elt_set -> bool) -> t -> t
        val filter        : (key -> elt -> bool) -> t -> t
        val of_list       : ?acc:t -> (key * elt) list -> t
        val to_list       : ?acc:(key * elt) list -> ?sort:unit -> t -> (key * elt) list
        val domain        : ?sort:unit -> t -> key list
        val codomain      : ?sorted_by_key:unit -> t -> elt list
        val restrict      : t -> key list -> t
        val diff          : t -> t -> t
        val inter         : t -> t -> t
        val union         : t -> t -> t
     end
added:
  STRUCTURES/multimap.ml
  STRUCTURES/multimap.mli


--
lp:ocamlbricks
https://code.launchpad.net/~marionnet-drivers/ocamlbricks/trunk

Your team marionnet-dev is subscribed to branch lp:ocamlbricks.
To unsubscribe from this branch go to https://code.launchpad.net/~marionnet-drivers/ocamlbricks/trunk/+edit-subscription