[Swift-devel] Wishlist: array elements assignment

Tiberiu Stef-Praun tiberius at ci.uchicago.edu
Fri Mar 16 12:24:28 CDT 2007


-------- excerpts from the code ----
(file out) solver (file in){
    app{
        solve @filename(in) stdout=filename(out)
    }
}


(file solutions[]) problemset (file inputfiles[]){
        // _input_ is the file item, _i_ is its index
        foreach file input,i in inputfiles {
                //FIXME: this one is an alternative that it would be
nice, because I could build the output filenames from input file names
on the fly
                file
solutions[i]<regexp_mapper;source=@input,match=(.*),transform="\1.out">;
                solutions[i]=solver(input);
        }
}

file problems[]<filesys_mapper; prefix="X", suffix="*.gz">;

//FIXME: alternative option for output file naming: declare them with
a regexp-like mapper from the input files:
file solutions[]<regexp_mapper;
source=@filenames(problems),match=(.*), transform="\1,out">

solutions=problemset(problems);

-------------------------

I'm open for alternatives
I have N input files that I have to process, and generate N output files.
I have complete control over the naming of the physical input and output files
Currently, I was trying to do file  X.gz generates file X.gz.out
(hence the regexp mapper, as a means of doing string concatenation).

See the FIXME comments for my thoughts

-- 
Tiberiu (Tibi) Stef-Praun, PhD
Research Staff, Computation Institute
5640 S. Ellis Ave, #405
University of Chicago
http://www-unix.mcs.anl.gov/~tiberius/



More information about the Swift-devel mailing list