Currently

someSequence.joined(separator: [])
someSequence.flatten()

(where someSequence is a sequence of sequences) results in two equal sequences 
(apart from their exact types). I would like to have flatten() renamed to 
joined(), resulting in joined(_:) seemingly having an empty array as the 
default parameter.

Similarly, I propose to give joined(_:) for a sequence of strings the empty 
string as the default parameter, allowing us to replace something like

["Hello, ", "world!"].joined(separator: "") // "Hello, world!"

with

["Hello, ", "world!"].joined() // "Hello, world!”

In other words, I think joined(_:) should have a default parameter of either 
`[]` or `””` and flatten() could then be removed as it would act the exact same 
way as joined().
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to