@@ -23,30 +23,30 @@ In recent standard library design meetings about the proper API for
23
23
sets, it was decided that the canonical ``Set `` interface should be
24
24
written in terms of methods: [#operators ]_ ::
25
25
26
- struct Set<T > {
27
- public func contains(x: T ) -> Bool // x ∈ A, A ∋ x
28
- public func isSubsetOf(b: Set<T >) -> Bool // A ⊆ B
29
- public func isStrictSubsetOf(b: Set<T >) -> Bool // A ⊂ B
30
- public func isSupersetOf(b: Set<T >) -> Bool // A ⊇ B
31
- public func isStrictSupersetOf(b: Set<T >) -> Bool // A ⊃ B
26
+ struct Set<Element > {
27
+ public func contains(x: Element ) -> Bool // x ∈ A, A ∋ x
28
+ public func isSubsetOf(b: Set<Element >) -> Bool // A ⊆ B
29
+ public func isStrictSubsetOf(b: Set<Element >) -> Bool // A ⊂ B
30
+ public func isSupersetOf(b: Set<Element >) -> Bool // A ⊇ B
31
+ public func isStrictSupersetOf(b: Set<Element >) -> Bool // A ⊃ B
32
32
...
33
33
}
34
34
35
35
When we started to look at the specifics, however, we ran into a
36
36
familiar pattern::
37
37
38
38
...
39
- public func union(b: Set<T >) -> Set<T> // A ∪ B
40
- public mutating func unionInPlace(b: Set<T >) // A ∪= B
39
+ public func union(b: Set<Element >) -> Set<Element> // A ∪ B
40
+ public mutating func unionInPlace(b: Set<Element >) // A ∪= B
41
41
42
- public func intersect(b: Set<T >) -> Set<T> // A ∩ B
43
- public mutating func intersectInPlace(b: Set<T >) // A ∩= B
42
+ public func intersect(b: Set<Element >) -> Set<Element> // A ∩ B
43
+ public mutating func intersectInPlace(b: Set<Element >) // A ∩= B
44
44
45
- public func subtract(b: Set<T >) -> Set<T> // A - B
46
- public mutating func subtractInPlace(b: Set<T >) // A -= B
45
+ public func subtract(b: Set<Element >) -> Set<Element> // A - B
46
+ public mutating func subtractInPlace(b: Set<Element >) // A -= B
47
47
48
- public func exclusiveOr(b: Set<T >) -> Set<T> // A ⊕ B
49
- public mutating func exclusiveOrInPlace(b: Set<T >) // A ⊕= B
48
+ public func exclusiveOr(b: Set<Element >) -> Set<Element> // A ⊕ B
49
+ public mutating func exclusiveOrInPlace(b: Set<Element >) // A ⊕= B
50
50
51
51
We had seen the same pattern when considering the API for
52
52
``String ``, but in that case, there are no obvious operator
0 commit comments