[Swift-user] question about SwiftScript
Jim Kowalkowski
jbk at fnal.gov
Tue Sep 18 11:45:59 CDT 2007
Hello,
I have a question about SwiftScript. Should I expect the following to work?
If not, why should I not expect it to work?
Please assume that the app works - I've tested this part on a simpler
script.
At the bottom is the test functions that actually work.
Thanks in advance,
Jim Kowalkowski
Fermilab CD
--------------------
type file { };
(file o) gen0() {
app {
echo2 @filename(o);
}
}
(file o) genn(file i)
{
app {
echo @filename(i) @filename(o);
}
}
(file o) appl_0 ()
{
o = gen0();
}
(file all[]) appl_n (int j)
{
if (j == 0) {
all[0] = gen0();
} else {
int k = j - 1;
all = appl_n (k);
all[j] = genn(all[k]);
}
}
string filenames = "0.txt 1.txt 2.txt 3.txt 4.txt 5.txt";
file ifiles[] <fixed_array_mapper;files=filenames>;
ifiles = appl_n(5);
#------ if I run the function below, it works fine -------
(file inputfiles[]) simple_run ()
{
inputfiles[5] = genn (inputfiles[4]);
inputfiles[4] = genn (inputfiles[3]);
inputfiles[3] = genn (inputfiles[2]);
inputfiles[2] = genn (inputfiles[1]);
inputfiles[1] = genn (inputfiles[0]);
inputfiles[0] = gen0 ();
}
files more[] = <fixed_array_mapper; files=filenames>;
more = simple_run();
#-------- I ran also run this and it works ----------
run_dep (file fs[], int curr)
{
int prev = curr - 1;
fs[curr] = genn( fs[prev] );
}
(file inputfiles[]) other_run ()
{
inputfiles = run_dep(5);
inputfiles = run_dep(4);
inputfiles = run_dep(3);
inputfiles = run_dep(2);
inputfiles = run_dep(1);
inputfiles[0] = gen0();
}
more = other_run();
More information about the Swift-user
mailing list