Re: [swift-evolution] [Pitch] Unify joined(separator:) and flatten()

2016-07-24 Thread Jacob Bandes-Storch via swift-evolution
Yep. With my proposed renaming this would work: [["hey"], ["what"]].joined().joined(separator: “”) But so would this, if you prefer it: [["hey"], ["what"]].joined().joined() On Sun, Jul 24, 2016 at 6:06 PM, Jose Cheyo Jimenez wrote: > [["hey"], ["what"]].joined().joined() // proposed > > vs >

Re: [swift-evolution] [Pitch] Unify joined(separator:) and flatten()

2016-07-24 Thread Jose Cheyo Jimenez via swift-evolution
[["hey"], ["what"]].joined().joined() // proposed vs [["hey"], ["what"]].flatten().joined(separator: “”) // now I do agree that having two way of doing it now seems odd. [["hey"], ["what"]].joined(separator: []).joined(separator: “”) // now > On Jul 24, 2016, at 5:47 PM, Jacob Bandes-Stor

Re: [swift-evolution] [Pitch] Unify joined(separator:) and flatten()

2016-07-24 Thread Jacob Bandes-Storch via swift-evolution
The thing is, joined also works on arrays-of-arrays today. The only difference is that flatten doesn't have a separator. We wouldn't lose what your example shows — you could do this: [["hey"], ["what"]].joined().joined(separator: “") On Sun, Jul 24, 2016 at 5:45 PM Jose Cheyo Jimenez wrote: > H

Re: [swift-evolution] [Pitch] Unify joined(separator:) and flatten()

2016-07-24 Thread Jose Cheyo Jimenez via swift-evolution
Here is a quick example that we would loose. [["hey"], ["what"]].flatten().joined(separator: “") [["hey"], ["what"]].flatten() // ["hey", "what”] The way I think of it is flatten works on array of arrays while joined works on arrays of strings. I guess we could do this too [["hey"], ["what"

Re: [swift-evolution] [Pitch] Unify joined(separator:) and flatten()

2016-07-24 Thread Jose Cheyo Jimenez via swift-evolution
-1 for this. To me there needs to be a difference between String (which is not a normal collection) and other regular collections. In addition, I really don’t think this proposal has the needed strong support for the change. > On Jul 22, 2016, at 3:41 PM, Jacob Bandes-Storch via swift-evol

Re: [swift-evolution] [Pitch] Unify joined(separator:) and flatten()

2016-07-22 Thread Jacob Bandes-Storch via swift-evolution
Here's a proposal draft. Comments welcome: https://gist.github.com/jtbandes/7978dc1848f7c37eeaa8e9aba27c7325 On Fri, Jul 22, 2016 at 2:51 PM, Ben Rimmington wrote: > > > On 22 Jul 2016, at 20:43, Jacob Bandes-Storch > wrote: > > > >> On Fri, Jul 22, 2016 at 8:35 AM, Ben Rimmington > wrote: >

Re: [swift-evolution] [Pitch] Unify joined(separator:) and flatten()

2016-07-22 Thread Ben Rimmington via swift-evolution
> On 22 Jul 2016, at 20:43, Jacob Bandes-Storch wrote: > >> On Fri, Jul 22, 2016 at 8:35 AM, Ben Rimmington >> wrote: >> >>> On 22 Jul 2016, at 02:46, Jacob Bandes-Storch wrote: >>> >>> In the swift-lang Slack channel, a few of us were discussing >>> joined(separator:) and realized that fla

Re: [swift-evolution] [Pitch] Unify joined(separator:) and flatten()

2016-07-22 Thread Jacob Bandes-Storch via swift-evolution
On Fri, Jul 22, 2016 at 8:35 AM, Ben Rimmington wrote: > > > On 22 Jul 2016, at 02:46, Jacob Bandes-Storch wrote: > > > > In the swift-lang Slack channel, a few of us were discussing > joined(separator:) and realized that flatten() does almost exactly the same > thing. > > > > Is there interest i

Re: [swift-evolution] [Pitch] Unify joined(separator:) and flatten()

2016-07-22 Thread Ben Rimmington via swift-evolution
> On 22 Jul 2016, at 02:46, Jacob Bandes-Storch wrote: > > In the swift-lang Slack channel, a few of us were discussing > joined(separator:) and realized that flatten() does almost exactly the same > thing. > > Is there interest in renaming flatten() to joined()? Since joined takes a > separ

[swift-evolution] [Pitch] Unify joined(separator:) and flatten()

2016-07-21 Thread Jacob Bandes-Storch via swift-evolution
In the swift-lang Slack channel, a few of us were discussing joined(separator:) and realized that flatten() does almost exactly the same thing. 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