TwbSet API

class type ['basetype] twbset = object('typesettype) method add : 'basetype -> 'typesettype method add_filter : ('basetype -> 'basetype -> bool ) -> 'basetype -> 'typesettype method addlist : 'basetype list -> 'typesettype method del : 'basetype -> 'typesettype method mem : 'basetype -> bool method elements : 'basetype list method hd : 'basetype method is_empty : bool method filter : ('basetype -> bool) -> 'typesettype method length : int method cardinal : int method intersect : 'typesettype -> 'typesettype method union: 'typesettype -> 'typesettype method subset: 'typesettype -> bool method is_equal : 'typesettype -> bool method copy : 'typesettype method empty : 'typesettype method to_string : string end The TwbSet API is parametrized in the its input type. In the following let ''' 'basetype ''' be the base type (eg. a formula or a Formula.set ) and ''' 'twbsettype ''' the resulting type TwbSet.set . We now explain all methods * method add : 'basetype -> 'typesettype : add en element of type 'basetype to the object and return the modified object. Example: (* add : (formula list * Formula.set) -> Formula.set *) let add (l,h) = h#addlist l * method add_filter : ('basetype -> 'basetype -> bool ) -> 'basetype -> 'typesettype * method addlist : 'basetype list -> 'typesettype : add a list of elements * method del : 'basetype -> 'typesettype : remove one element * method mem : 'basetype -> bool : check if an element is present * method elements : 'basetype list : return the list of element in the object * method hd : 'basetype : return an element of the object. If the data type is implemented as a list, then it returns the first element of the list, otherwise it returns an unspecified element of the collection. * method is_empty : bool : check if the object is empty * method filter : ('basetype -> bool) -> 'typesettype * method length : int : returns the cardinality of the object * method cardinal : int : same as ''length'' * method intersect : 'typesettype -> 'typesettype * method union: 'typesettype -> 'typesettype * method subset: 'typesettype -> bool * method is_equal : 'typesettype -> bool * method copy : 'typesettype : return a deep copy of the object * method empty : 'typesettype : return an empty instance of the object * method to_string : string : return a string containing the human readable representation of the object