[Swift-devel] New syntax for appending to arrays

Jonathan Monette jonmon at utexas.edu
Tue Jun 28 12:21:56 CDT 2011


I guess my question would be what would a look like?  What if this was called.

int a[];
int b[];
a=[1,2,3];
b=[4,5,6];

a+=b;

Saying append makes me think that a+=b would result in something like:

[1,2,3[4,5,6]]

Is this the case?  Or would it be [1,2.3,4,5,6].  In python this is called extend while the first is called append.

So are we talking about an extend operation or append operation?

On Jun 28, 2011, at 12:17 PM, Mihael Hategan wrote:

> On Tue, 2011-06-28 at 09:04 -0500, Michael Wilde wrote:
> 
>> int a[][[];
>> int b[];
>> b += 100;
>> b += 200;
>> a += b;  # <=== should this append a new array to a?
> 
> It should append something to a. And the type of a is int array which
> matches b's type, so I don't see why not.
> 
> _______________________________________________
> Swift-devel mailing list
> Swift-devel at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel




More information about the Swift-devel mailing list