[Swift-devel] Re: Problems with karajan lists
Mihael Hategan
hategan at mcs.anl.gov
Thu Nov 11 16:35:11 CST 2010
Append is append(list, items) -> list. So it returns a list.
If you are only interested in the side-effect of append, you can
probably do:
discard(append(list, 10)).
Alternatively you could say:
vec := list()
vec := append(list, 10)
Mihael
On Thu, 2010-11-11 at 16:28 -0600, Michael Wilde wrote:
> I'm trying to append to a list multiple times, but when I try to append the second time, I get an error:
>
> import("sys.k")
> sequential(
> vec := list()
> append(vec,10)
> print(vec)
> // append(vec,20)
> // print(vec)
> )
>
> If I uncomment the 2 lines above, I get the error:
>
> login1$ swift foo.k
> [10.0]
> [10.0, 20.0]
> Ex098
> org.globus.cog.karajan.workflow.KarajanRuntimeException: Illegal extra argument `[10.0, 20.0]' to kernel:karajan @ foo.k, line: 1
> at org.globus.cog.karajan.arguments.NameBindingVariableArguments.append(NameBindingVariableArguments.java:58)
>
> Its almost as if append is not consuming its arguments and Karajan is finding extra stuff on the stack when it exits???
>
> Can you help me understand what Im doing wrong here?
>
> Thanks,
>
> Mike
>
>
More information about the Swift-devel
mailing list