Module Lset

module Lset: sig .. end
Sets as ordered polymorphic lists (Sébastien Ferré)

License: LGPL
Author(s): : Sébastien Ferré
See also Home page


include List
val compare : 'a -> 'a -> int
type 'a t = 'a list 
val empty : unit -> 'a list
The empty set.
val is_empty : 'a list -> bool
Test if a set is empty or not.
val cardinal : 'a list -> int
Return the cardinal of a set.
val elements : 'a t -> 'a list
Return a list of the elements.

Comparison of 2 sets for any relation among: Contains, Contained, Equals, Other.
type comp = 
| Contains
| Contained
| Equals
| Other
val comp : 'a list -> 'a list -> comp
val contains : 'a list -> 'a list -> bool
Return true if the first set contains the second.
val subset : 'a list -> 'a list -> bool
val equal : 'a -> 'a -> bool
val mem : 'a -> 'a list -> bool
val union : 'a list -> 'a list -> 'a list
Return the union of 2 and several sets.
val union_r : 'a list list -> 'a list
val add : 'a -> 'a list -> 'a list
val singleton : 'a -> 'a list
val of_list : 'a list -> 'a t
Get a set from a list.
val inter : 'a list -> 'a list -> 'a list
Return the intersection of 2 sets.
val inter_r : 'a list list -> 'a list
val subtract : 'a list -> 'a list -> 'a list
Return the subtraction of 2 sets.
val diff : 'a list -> 'a list -> 'a list
val subtract_r : 'a list -> 'a list list -> 'a list
val remove : 'a -> 'a list -> 'a list
val partition_set : 'a t -> 'a t -> 'a t * 'a t
val flip : 'a -> 'a list -> 'a list
Remove an element if present, add it otherwise.

Generic folding over the synchronized traversal of 2 LSets
type inwhich = 
| Infst
| Insnd
| Inboth
val fold : ('b -> inwhich * 'a -> 'b) -> 'b -> 'a list -> 'a list -> 'b