[swift-evolution] [Draft] Rename Sequence.elementsEqual
Xiaodi Wu
xiaodi.wu at gmail.com
Fri Oct 13 23:02:20 CDT 2017
On Fri, Oct 13, 2017 at 8:45 PM, Brent Royal-Gordon <brent at architechies.com>
wrote:
> > On Oct 12, 2017, at 9:57 PM, Kevin Nattinger via swift-evolution <
> swift-evolution at 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!, …)
>
> 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.
>
Fair enough suggestion as well.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171013/44c6afef/attachment.html>
More information about the swift-evolution
mailing list