Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- strInp = OpenRead ["Test.in"];
- strOut = OpenWrite ["Test.out"];
- While[(str=Read[strInp, Number) != EndOfFile,
- out = yourprocess[str];
- Write [strOut,out];
- ];
- Close [strOut];
- Close [strInp];
- (* Now show the output file *)
- FilePrint ["Test.out]
- (* step one: get data *)
- data = Import["ideone_fM0rs.txt", "Lines"];
- (* step two: ??? *)
- res = {};
- Module[{value, result},
- value = #;
- result = yourCodeHere[value];
- AppendTo[res, result];
- ]& /@ data;
- (* step three: PROFIT! *)
- Export["out.txt", res, "Lines"];
- data = Import["ideone_fM0rs.txt", "Lines"];
- res = Reap[Module[{value, result, tag},
- value = #;
- result = yourCodeHere[value];
- tag = generateTag[value]
- Sow[result, tag];
- ]& /@ data, _, Rule][[2]];
- Export["out.txt", res, "Lines"];
- data = ReadList["Test.in", Number, RecordLists-> True];
- vals = Import["http://ideone.com/fM0rs",
- "Table"] /. {aa_ /; ! NumberQ[aa] && FreeQ[aa, List], ___} :>
- Sequence[] /. {} :> Sequence[]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement