On Sat, Oct 14, 2017 at 3:45 AM, Brent Royal-Gordon via swift-evolution < swift-evolution@swift.org> wrote:
> > On Oct 12, 2017, at 9:57 PM, Kevin Nattinger via swift-evolution < > swift-evolution@swift.org> wrote: > > > > That is reflected in the fact that over half the methods in the main > Sequence definition* make no sense and are not well-defined unless there is > a well-defined order to the sequence itself. What does it even mean to > `dropFirst()` in a Set? > > It means to skip the first element the set would normally have given you. > Which element this will be may be arbitrary, but this is still not useless: > > set.dropFirst().reduce(set.first!, …) > Do we have the guarantee that set.dropFirst() is going to return the same element as set.first! ? I don't understand how you can build generic algorithms over Sequence using first() and last() that work if the protocol itself doesn't give any guarantee about ordering.. Unless "first" and "last" both mean "any"... > > Even elementsEqual(_:) does tell you something potentially valuable: > Whether two instances will end up giving the same result when processed by > an ordering-sensitive algorithm. > > We should change the name to something like orderEquals(_:), and maybe > change the lexicographicallyPrecedes(_:) method to something analogous like > orderPrecedes(_:), and then be done with it. > > -- > Brent Royal-Gordon > Sent from my iPhone > > _______________________________________________ > swift-evolution mailing list > swift-evolution@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution >
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution