[Swift-user] associative array append -- not implemented? misconfigured?

Vasily Trubetskoy trubetskoy at uchicago.edu
Fri May 10 13:59:24 CDT 2013


Hi all --

I am starting work with swift, and am testing out some of the language
features. I have copied the following from the user guide

*int[auto] array;
> foreach i in [1:100] {
>   append(array, i * 2);
> }
> foreach v in array {
>   trace(v);
> }*


into a file *append_test.swift, *which is run with the following command:

/opt/swift-0.94/bin/swift append_test.swift


This returns the error:

*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.*


Is the append feature not implemented in the stable branch? I have a
specific application in mind where it would be very useful. Is this perhaps
some misconfiguration in my installation?

Please let me know if any additional information is required (system, tc or
sites files, etc.). Otherwise, any help would be much appreciated!

Version details:
*Swift 0.94 swift-r6492 cog-r3658 (downloaded binary release)*
*
*
Log dump:

*2013-05-10 13:49:50,724-0500 DEBUG Loader arguments: [append_test.swift]
> 2013-05-10 13:49:50,725-0500 DEBUG Loader Max heap: 954466304
> 2013-05-10 13:49:50,726-0500 DEBUG textfiles BEGIN SWIFTSCRIPT:
> int[auto] array;
> foreach i in [1:100] {
>   append(array, i * 2);
> }
> foreach v in array {
>   trace(v);
> }
>
> 2013-05-10 13:49:50,726-0500 DEBUG textfiles END SWIFTSCRIPT:
> 2013-05-10 13:49:50,726-0500 INFO  Loader append_test.swift: source file
> is new. Recompiling.
> 2013-05-10 13:49:51,102-0500 DEBUG Loader Detailed exception:
> org.griphyn.vdl.karajan.CompilationException: Compile error in foreach
> statement at line 3
> at org.griphyn.vdl.engine.Karajan.foreachStat(Karajan.java:1001)
> at org.griphyn.vdl.engine.Karajan.statement(Karajan.java:681)
> at org.griphyn.vdl.engine.Karajan.statements(Karajan.java:641)
> at org.griphyn.vdl.engine.Karajan.program(Karajan.java:314)
> at org.griphyn.vdl.engine.Karajan.compile(Karajan.java:138)
> at org.griphyn.vdl.karajan.Loader.compile(Loader.java:350)
> at org.griphyn.vdl.karajan.Loader.main(Loader.java:171)
> Caused by: org.griphyn.vdl.karajan.CompilationException: Compile error in
> procedure invocation at line 4
> at org.griphyn.vdl.engine.Karajan.call(Karajan.java:886)
> at org.griphyn.vdl.engine.Karajan.statement(Karajan.java:678)
> at org.griphyn.vdl.engine.Karajan.statements(Karajan.java:641)
> at org.griphyn.vdl.engine.Karajan.foreachStat(Karajan.java:993)
> ... 6 more
> Caused by: org.griphyn.vdl.karajan.CompilationException: Procedure append
> is not declared.
> at org.griphyn.vdl.engine.Karajan.call(Karajan.java:708)
> ... 9 more*

*
*
*
*
-- 
Vasily Trubetskoy
Data Analyst, Cox Lab
University of Chicago
Chicago, IL 60637
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-user/attachments/20130510/f6874642/attachment.html>


More information about the Swift-user mailing list