[Swift-devel] loops and strings

Veronika Nefedova nefedova at mcs.anl.gov
Fri Jul 27 10:22:52 CDT 2007


I am not sure if its possible to do string operations inside the loop  
in swift?
I have a versy simple test code that doesn't work no matter what.  
Obviously, I am missing something.
This is the code:

file fls[]<filesys_mapper;pattern="*.prt",location=".">;
string wham_string = "#";
foreach prt_file in fls
{
       wham_string = @strcat (wham_string, ", wham");
       print (wham_string);
}
print (wham_string);


basically I expect to have this as an output:  
#,wham,wham,wham,wham,... (its a test code (-;)

instead I have these errors:

wham_string is already assigned with a value of #
wham_string is already assigned with a value of #
         vdl:assign @ test.kml, line: 46
         vdl:mains @ test.kml, line: 39
Caused by: java.lang.IllegalArgumentException: wham_string is already  
assigned with a value of #
         at org.griphyn.vdl.mapping.AbstractDataNode.setValue 
(AbstractDataNode.java:255)
         at org.griphyn.vdl.karajan.lib.Assign.function(Assign.java:70)
<snip>


In any case -- if I can't construct the string by using the loop -  
how else could it be done?

I use the constructed string then to map an array (I understand I  
can't map individual array elements):

file whamfiles_$s[] <fixed_array_mapper;files="$wham_string">; //it  
was in the wrapper script before)


Nika




More information about the Swift-devel mailing list