(* This module implements sets as ordered lists, using the generic comparison function. Hence: -- it does not work properly if elements are mutable! -- all generic comparisson functions (=, <>, <, >, etc.) work perfectly on elements of type 'a set, since all set have a unique canonical form. *) type 'a set val empty : 'a set val of_list : 'a list -> 'a set (* "of_list l" creates a set whose elements are l *) val to_list : 'a set -> 'a list (* "to_list s" return the list of elements of set s *) val mem : 'a -> 'a set -> bool (* "mem x s" tests whether x is an element of set s *) val union : 'a set -> 'a set -> 'a set val union_list : 'a set list -> 'a set (* "union_list l" returns the union of all sets in l *) val diff : 'a set -> 'a set -> 'a set (* "diff p q" returns the set of elements that are in p but not in q *) val iter : ('a -> unit) -> 'a set -> unit (* "iter f p" applied f once to all elements of f (in arbitrary order) *) val inter : 'a set -> 'a set -> 'a set (* "inter p q" returns the intersection of sets p and q *) val add : 'a -> 'a set -> 'a set (* "add x s" adds the element x to the set s *) val remove : 'a -> 'a set -> 'a set (* "remove x s" remove the element x from the set s *)