[Swift-commit] r6946 - SwiftTutorials/CIC_2013-08-09/part03
wilde at ci.uchicago.edu
wilde at ci.uchicago.edu
Thu Aug 22 11:28:53 CDT 2013
Author: wilde
Date: 2013-08-22 11:28:53 -0500 (Thu, 22 Aug 2013)
New Revision: 6946
Added:
SwiftTutorials/CIC_2013-08-09/part03/p3.swift
Log:
fix svn prob w p3
Added: SwiftTutorials/CIC_2013-08-09/part03/p3.swift
===================================================================
--- SwiftTutorials/CIC_2013-08-09/part03/p3.swift (rev 0)
+++ SwiftTutorials/CIC_2013-08-09/part03/p3.swift 2013-08-22 16:28:53 UTC (rev 6946)
@@ -0,0 +1,28 @@
+
+type file;
+
+app (file o) mysim (int steps, int values)
+{
+ simulate "--timesteps" steps "--nvalues" values stdout=@filename(o);
+}
+
+app (file o) analyze (file s[])
+{
+ stats @filenames(s) stdout=@filename(o);
+}
+
+int nsim = @toInt(@arg("nsim","10"));
+int steps = @toInt(@arg("steps","1"));
+int values = @toInt(@arg("values","5"));
+
+file sims[];
+
+foreach i in [0:nsim-1] {
+ file simout <single_file_mapper; file=@strcat("output/sim_",i,".out")>;
+ simout = mysim(steps,values);
+ sims[i] = simout;
+}
+
+file stats<"output/average.out">;
+stats = analyze(sims);
+
More information about the Swift-commit
mailing list