[swift-evolution] [Draft] Rename Sequence.elementsEqual
Jonathan Hull
jhull at gbis.com
Tue Oct 17 14:00:21 CDT 2017
> On Oct 17, 2017, at 11:47 AM, Michael Ilseman via swift-evolution <swift-evolution at swift.org> wrote:
>
> `==` conveys substitutability of the two Sequences. This does not necessarily entail anything about their elements, how those elements are ordered, etc., it just means two Sequences are substitutable. `elementsEqual` means that the two Sequences produce substitutable elements. These are different concepts and both are independently useful.
I agree that ‘==‘ conveys substitutability. Here is the issue:
let a = Set([1,2,3,4,5])
let b = Set([5,4,3,2,1])
a == b //True, they are substitutable
[1,2,3,4,5].elementsEqual(a) //True
[1,2,3,4,5].elementsEqual(b) //False… I guess they weren’t actually substitutable after all
Thanks,
Jon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171017/ddc38b51/attachment.html>
More information about the swift-evolution
mailing list