[Swift-user] Question about arrays and ordering of execution

Mihael Hategan hategan at mcs.anl.gov
Fri Mar 22 14:16:40 CDT 2013


On Fri, 2013-03-22 at 14:00 -0500, Lorenzo Pesce wrote:
> I apologize if I asked this question already or it is obvious, sometimes  I mix all these problems together...
> 
> I start with having a number of files associated with a specific Sample, do something with all of them, then merge them and move on to do more things (which also involved splitting them and remerging them). 
> 
> My rough swift code for it would be the following.
> 
> string [] FILES = readdata.... ;
> 
> string {} OUTFILES = <some mapper >; # don't exist yet
> 
> for file in FILES {
> 
>  (OUTFILE{file}...) do_something (file);
> }
> 
> (next_file) = do_somethingmore(OUTFILE);
> 
> 
> My question is: can I use an array/hash of files as input to a function and will this be sufficient to tell swift to wait till *all* the OUTFILE elements have been run?

Yes. Swift will wait for all the input parameters to an app (and that
includes waiting until it knows exactly how many items are in an array -
i.e., when it knows that no more items will ever be added).

Mihael





More information about the Swift-user mailing list