[Swift-devel] New syntax for appending to arrays

Yadu Nand yadudoc1729 at gmail.com
Wed Jun 29 13:49:20 CDT 2011


> You shouldn't be seeing multiple threads with the same thread id.
I was working with this assumption.

I tried
int array[ ];
foreach outer in [1:2]{
foreach inner in [1:10]{
        array += inner;        trace(inner);
}}
This works fine.

> For example, if you do this:
> foreach dummy in [1] {
>  foreach i in [1:10] {
>    a += i; // or whatever syntax was chosen to be? a << i ?
>  }
>
>  foreach value, key in a {
>  trace(key);
>  }
> }
> should give 10 unique thread IDs as traced values. Those IDs won't be
> integers in general, though.

I am having some issue with array appends in nested loops. I'm pasting
the code here, I have attached the output, logs and kml generated.
Any help will be appreciated.

int array[ ][ ];
foreach dummy in [1:2] {
        array["key"] += 1;
        array["key"] += 2;
        foreach v in array["key"]{
        trace (v);
        }
}

-- 
Thanks and Regards,
Yadu Nand B
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.output
Type: application/octet-stream
Size: 903 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20110630/f0ee47b1/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.kml
Type: application/vnd.google-earth.kml+xml
Size: 7356 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20110630/f0ee47b1/attachment.kml>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t-20110630-0013-f75upjc9.log
Type: text/x-log
Size: 6899 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20110630/f0ee47b1/attachment.bin>


More information about the Swift-devel mailing list