<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">-1 for this. To me there needs to be a difference between String (which is not a normal collection) and other regular collections. </div><div class=""><br class=""></div><div class="">In addition, I really don’t think this proposal has the needed strong support for the change. </div><div class=""><br class=""></div><div class=""><br class=""><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 22, 2016, at 3:41 PM, Jacob Bandes-Storch via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Here's a proposal draft. Comments welcome:<div class=""><br class=""></div><div class=""><a href="https://gist.github.com/jtbandes/7978dc1848f7c37eeaa8e9aba27c7325" class="">https://gist.github.com/jtbandes/7978dc1848f7c37eeaa8e9aba27c7325</a></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Jul 22, 2016 at 2:51 PM, Ben Rimmington<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:me@benrimmington.com" target="_blank" class="">me@benrimmington.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><span class=""><br class="">> On 22 Jul 2016, at 20:43, Jacob Bandes-Storch <<a href="mailto:jtbandes@gmail.com" class="">jtbandes@gmail.com</a>> wrote:<br class="">><br class="">>> On Fri, Jul 22, 2016 at 8:35 AM, Ben Rimmington <<a href="mailto:me@benrimmington.com" class="">me@benrimmington.com</a>> wrote:<br class="">>><br class="">>>> On 22 Jul 2016, at 02:46, Jacob Bandes-Storch wrote:<br class="">>>><br class="">>>> In the swift-lang Slack channel, a few of us were discussing joined(separator:) and realized that flatten() does almost exactly the same thing.<br class="">>>><br class="">>>> Is there interest in renaming flatten() to joined()? Since joined takes a separator that's any Sequence, we can't have a default value for the separator parameter, but we can have a variant of joined() with no arguments.<br class="">>><br class="">>> I'd like default separators for the joined() methods.<br class="">>><br class="">>> <<a href="https://bugs.swift.org/browse/SR-1428" rel="noreferrer" target="_blank" class="">https://bugs.swift.org/browse/SR-1428</a>><br class="">>><br class="">>> But renaming flatten() to joined() seems complicated.<br class="">>><br class="">>> <<a href="https://github.com/apple/swift/blob/master/stdlib/public/core/Flatten.swift.gyb" rel="noreferrer" target="_blank" class="">https://github.com/apple/swift/blob/master/stdlib/public/core/Flatten.swift.gyb</a>><br class="">>> <<a href="https://github.com/apple/swift/blob/master/stdlib/public/core/Join.swift" rel="noreferrer" target="_blank" class="">https://github.com/apple/swift/blob/master/stdlib/public/core/Join.swift</a>><br class="">><br class="">> What makes it seem complicated? At the very least, one could just rename the flatten() function. There might also be an opportunity to combine the two files and delete some code from stdlib.<br class=""><br class=""></span>There's only one joined() method (for a sequence of sequences):<br class=""><br class=""> <span class="Apple-converted-space"> </span>extension Sequence {<br class=""> <span class="Apple-converted-space"> </span>func joined<Separator: Sequence>(separator: Separator) -> JoinedSequence<Self><br class=""> <span class="Apple-converted-space"> </span>}<br class=""><br class="">There are many flatten() methods (`where` clauses omitted for brevity):<br class=""><br class=""> <span class="Apple-converted-space"> </span>extension Sequence {<br class=""> <span class="Apple-converted-space"> </span>func flatten() -> FlattenSequence<Self><br class=""> <span class="Apple-converted-space"> </span>}<br class=""><br class=""> <span class="Apple-converted-space"> </span>extension LazySequenceProtocol {<br class=""> <span class="Apple-converted-space"> </span>func flatten() -> LazySequence<FlattenSequence<Self.Elements>><br class=""> <span class="Apple-converted-space"> </span>}<br class=""><br class=""> <span class="Apple-converted-space"> </span>extension LazyCollectionProtocol {<br class=""> <span class="Apple-converted-space"> </span>func flatten() -> LazyCollection<FlattenCollection<Self.Elements>><br class=""> <span class="Apple-converted-space"> </span>}<br class=""><br class=""> <span class="Apple-converted-space"> </span>extension Collection {<br class=""> <span class="Apple-converted-space"> </span>func flatten() -> FlattenCollection<Self><br class=""> <span class="Apple-converted-space"> </span>}<br class=""><br class=""> <span class="Apple-converted-space"> </span>extension BidirectionalCollection {<br class=""> <span class="Apple-converted-space"> </span>func flatten() -> FlattenBidirectionalCollection<Self><br class=""> <span class="Apple-converted-space"> </span>}<br class=""><br class="">So it's not a simple one-to-one rename.<br class=""><br class="">When there's no `separator` argument, will FlattenIterator perform better than JoinedIterator?<br class=""><span class=""><br class="">>> And what would happen to the flatMap() methods? Is flatten() a term of art?<br class="">>><br class="">>> <<a href="https://github.com/apple/swift/blob/master/stdlib/public/core/FlatMap.swift" rel="noreferrer" target="_blank" class="">https://github.com/apple/swift/blob/master/stdlib/public/core/FlatMap.swift</a>><br class="">><br class="">> I'd say flatMap is more a "term of art" than flatten. "flatten" just describes literally what is being done. Frankly I'm surprised it was never named flattened(). Anyway, flatMap should stay.<br class=""><br class=""></span>## Future directions<br class=""><br class="">Will the flatMap(_:) methods also have flatMap(separator:_:) variants?<br class=""></blockquote><div class=""><br class=""></div><div class="">That's an interesting idea. It seems to be purely additive, however, so I imagine it wouldn't happen until after Swift 3.</div><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><span class="HOEnZb"><font color="#888888" class=""><br class="">-- Ben<br class=""><br class=""></font></span></blockquote></div><br class=""></div></div><span style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">swift-evolution mailing list</span><br style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">swift-evolution@swift.org</a><br style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></div></div></body></html>