[swift-evolution] ed/ing, InPlace, Set/SetAlgebra naming resolution

Stephen Canon scanon at apple.com
Thu Feb 11 13:42:44 CST 2016


Yes, “symmetric difference” is the common name for this operation in Mathematics.
– Steve

> On Feb 11, 2016, at 2:41 PM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
> 
> 'Symmetric difference' sounds weird to me too, but per Wikipedia, the
> counterpart name to 'union' and 'intersection' for the result of a XOR
> operation on a set would in fact be the 'symmetric difference,' with
> apparently no alternative or more commonly used name:
> 
>> * Union of the sets A and B, denoted A ∪ B, is the set of all objects that are a member of A, or B, or both. The union of {1, 2, 3} and {2, 3, 4} is the set {1, 2, 3, 4} .
>> * Intersection of the sets A and B, denoted A ∩ B, is the set of all objects that are members of both A and B. The intersection of {1, 2, 3} and {2, 3, 4} is the set {2, 3} .
> ...
>> * Symmetric difference of sets A and B, denoted A △ B or A ⊖ B, is the set of all objects that are a member of exactly one of A and B (elements which are in one of the sets, but not in both). For instance, for the sets {1,2,3} and {2,3,4} , the symmetric difference set is {1,4} . It is the set difference of the union and the intersection, (A ∪ B) \ (A ∩ B) or (A \ B) ∪ (B \ A).
> 
> 
> On Thu, Feb 11, 2016 at 1:26 PM, Erica Sadun via swift-evolution
> <swift-evolution at swift.org> wrote:
>> xor is a well known and widely used synonym. "symmetricDifference" not so
>> much.
>> 
>> -- E
>> 
>> 
>> On Feb 11, 2016, at 12:22 PM, Stephen Canon <scanon at apple.com> wrote:
>> 
>> 
>> On Feb 11, 2016, at 2:19 PM, Jacob Bandes-Storch via swift-evolution
>> <swift-evolution at swift.org> wrote:
>> 
>> On Thu, Feb 11, 2016 at 11:09 AM, Erica Sadun via swift-evolution
>> <swift-evolution at swift.org> wrote:
>>> 
>>> Non-Mutating, returning new value: unioned(with), intersected(with),
>>> exclusiveOred(with)
>>> 
>>> Reasoning:
>>> 
>>> * I think the -ing endings sound unnatural, stilted, and unmathematical.
>>> They make me wince.
>> 
>> 
>> So do the -ed versions, IMO. That's why -InPlace is such a convenient
>> suffix.
>> 
>> 
>> “exclusiveOr” is pretty awkward too.  I would tend to call this either “xor”
>> or “symmetricDifference”.
>> 
>> – Steve
>> 
>> 
>> 
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
>> 



More information about the swift-evolution mailing list