Changes between Version 14 and Version 15 of SetsCowan


Ignore:
Timestamp:
12/03/12 01:55:18 (5 years ago)
Author:
cowan
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SetsCowan

    v14 v15  
    33Sets and bags (multisets) are mutable collections that can contain any Scheme object.  Integer sets are mutable collections that can contain non-negative exact integers that are less than a maximum value specified when the integer set is created.  Enumeration sets are mutable collections that can contain symbols chosen from a set of symbols represented by an enumeration type. 
    44 
    5 Sets and bags (multisets) are intended to be a thin veneer over hashtables, and integer sets are a thin veneer over bit vectors.  In turn, enumeration sets are a thin veneer over integer sets.  Consequently, the `-member?`, `-add!`, and `-remove!` procedures are required to have an amortized cost of O(1). 
     5Sets and bags (multisets) are intended to be a thin veneer over hashtables, and integer sets are a thin veneer over bytevectors considered as sequences of bits.  In turn, enumeration sets are a thin veneer over integer sets.  Consequently, the `-member?`, `-add!`, and `-remove!` procedures are required to have an amortized cost of O(1). 
    66 
    77Sets, bags, integer sets, enumeration sets, and enumeration types are mutually disjoint, and disjoint from other types of Scheme objects. 
     
    99== Set procedures == 
    1010 
     11It is an error to operate on sets with different equality procedures. 
     12 
    1113`(make-set `''=''`)` 
    1214 
     
    8183Returns `#t` if each ''set'' other than the last is a superset of the following ''set'', and `#f` otherwise. 
    8284 
    83 `(set-union `''set,,1'` `''other-set,,2'' ...`)` 
     85`(set-union `''set,,1,,''` `''set,,2,,'' ...`)` 
    8486 
    8587Returns a newly allocated set that is the union of the ''sets''.  It is an error if the sets do not have the same equality predicate. 
    8688 
    87 `(set-intersection `''set,,1'` `''other-set,,2'' ...`)` 
     89`(set-intersection `''set,,1,,''` `''set,,2,,'' ...`)` 
    8890 
    8991Returns a newly allocated set that is the intersection of the ''sets''.  It is an error if the sets do not have the same equality predicate. 
    9092 
    91 `(set-difference `''set,,1'` `''other-set,,2'' ...`)` 
    92  
    93 Returns a newly allocated set that is the difference of the ''sets''.  It is an error if the sets do not have the same equality predicate. 
    94  
    95 `(set-xor `''set,,1''` `''set,,2''`)` 
    96  
    97 Returns a newly allocated set that is the xor (symmetric difference) of ''set,,1'' and ''set,,2,,''.  It is an error if the sets do not have the same equality predicate. 
    98  
    99 `(set-union! `''set,,1'` `''other-set,,2'' ...`)` 
    100  
    101 Mutates ''set'' to a new set that is the union of the ''sets''.  It is an error if the sets do not have the same equality predicate. 
    102  
    103 `(set-intersection! `''set,,1'` `''other-set,,2'' ...`)` 
    104  
    105 Mutates ''set'' to a new set that is the intersection of 'the ''sets''.  It is an error if the sets do not have the same equality predicate. 
    106  
    107 `(set-difference! `''set,,1'` `''other-set,,2'' ...`)` 
    108  
    109 Mutates ''set,,1'' to a new set that is the difference of the ''sets''.  It is an error if the sets do not have the same equality predicate. 
    110  
    111 `(set-xor! `''set,,1''` `''set,,2''`)` 
    112  
    113 Mutates ''set'' to a new set that is the xor (symmetric difference) of ''set,,1'' and ''set,,2''.  It is an error if the sets do not have the same equality predicate. 
     93`(set-difference `''set,,1,,''` `''set,,2,,'' ...`)` 
     94 
     95Returns a newly allocated set that is the asymmetric difference of ''set,,1,,'' and the union of the other ''sets''.  It is an error if the sets do not have the same equality predicate. 
     96 
     97`(set-xor `''set,,1,,''` `''set,,2,,''`)` 
     98 
     99Returns a newly allocated set that is the xor (symmetric difference) of ''set,,1,,'' and ''set,,2,,''. 
     100 
     101`(set-union! `''set,,1,,''` `''set,,2,,'' ...`)` 
     102 
     103Mutates ''set,,1,,'' to a set that is the union of the ''sets''.  It is an error if the sets do not have the same equality predicate. 
     104 
     105`(set-intersection! `''set,,1,,''` `set,,2,,'' ...`)` 
     106 
     107Mutates ''set,,1,,'' to a set that is the asymmetric difference of ''set,,1,,'' and the union of the other ''sets''.  It is an error if the sets do not have the same equality predicate. 
     108 
     109`(set-difference! `''set,,1,,''` `''set,,2,,'' ...`)` 
     110 
     111Mutates ''set,,1,,'' to a set that is the difference of the ''sets''.  It is an error if the sets do not have the same equality predicate. 
     112 
     113`(set-xor! `''set,,1,,''` `''set,,2,,''`)` 
     114 
     115Mutates ''set,,1,,'' to a new set that is the xor (symmetric difference) of ''set,,1,,'' and ''set,,2,,''.  It is an error if the sets do not have the same equality predicate. 
    114116 
    115117== Bag procedures == 
     
    121123Returns an exact integer representing the number of times that ''element'' appears in ''bag''. 
    122124 
     125`(bag-increment `''bag` `element` `count''`)` 
     126 
     127`(bag-decrement `''bag` `element` `count''`)` 
     128 
     129Increases or decreases the count of ''element'' in ''bag'' by the exact integer ''count''. 
     130 
    123131== Integer set procedures == 
    124132