[Swift-user] array append
Yadu Nand
yadudoc1729 at gmail.com
Fri Feb 28 16:19:49 CST 2014
Hi Greg,
Array appends are done using the append operator <<. I'll correct the
userguide to
use the right syntax. The following corrected snippet should work for you :
int[auto] array;
foreach i in [1:100] {
array << (i*2);
}
Thanks for reporting the bug.
-Yadu
On Fri, Feb 28, 2014 at 8:10 AM, Wilde, Michael J. <wilde at mcs.anl.gov>wrote:
> Greg, thanks for reporting this.
>
> We can reproduce it and have created a bug ticket:
> https://bugzilla.mcs.anl.gov/swift/show_bug.cgi?id=1207
>
> It seems that this feature was not in the test suite. Will post when we
> have a fix.
>
> - Mike
>
>
> From: <Bronevetsky>, Greg <bronevetsky1 at llnl.gov>
> Date: Thursday, February 27, 2014 6:31 PM
> To: Swift User <swift-user at ci.uchicago.edu>
> Subject: [Swift-user] array append
>
> I’m trying to use the array append function in Swift 0.94.1, based on
> Section 2.3 of the user guide (
> http://swift-lang.org/guides/release-0.94/userguide/userguide.html)
>
>
>
> Given the following program:
>
> int[auto] array;
>
>
>
> foreach i in [1:100] {
>
> append(array, i * 2);
>
> }
>
>
>
> I run swift on it and get this following error:
>
> > swift test.swift
>
> Could not start execution
>
> Compile error in foreach statement at line 3
>
> Compile error in procedure invocation at line 4
>
> Procedure append is not declared.
>
>
>
> How should I be using the append function to avoid this error? Thank you!
>
>
>
> Greg Bronevetsky
>
> Lawrence Livermore National Lab
>
> (925) 424-5756
>
> bronevetsky at llnl.gov
>
> http://greg.bronevetsky.com
>
>
>
>
> _______________________________________________
> Swift-user mailing list
> Swift-user at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user
>
--
Yadu Nand B
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-user/attachments/20140228/be9476ae/attachment.html>
More information about the Swift-user
mailing list