@@ -17,8 +17,15 @@ module[
1717 >> sets element 42 in b. as well. To have them independent, use this
1818 assert[var_type(arg) == constants('var_type').stem][' clone requires a stem as its argument'];
1919 return(from_json(to_json(arg)));
20- ];
20+ ];
2121
22+ define[string_copy(s, n)][
23+ >> Create a stem with 0 < n copies of a single string in it.
24+ out. := null;
25+ if[n <= 0][return([]);];
26+ while[for_next(j, [;n])][out.j := s;];
27+ return(out.);
28+ ];
2229
2330
2431 define[ fork(@monad1(),@dyad(),@monad2(),x.)][
@@ -36,22 +43,22 @@ module[
3643 return(dyad(monad1(x.),monad2(x.)));
3744 ];
3845
39- define[
40- to_csv(a.)
41- ][
42- >> convert a stem., a., to csv (comma separated values) format.
43- >> a. stem to be converted. Each element is a list and will be a line
44- >> in the output.
45- >> typical use is
46- >> file_write(my_file, to_cvs(data.));
47- >> E.g. here is the start of one
48- >> a.0 := ['t', 'x', 'y']; // header
49- >> a.1 := [0, .5, .345723445]; // first line of data
50- >> tip: [['t', 'x','y']]~a. would stick in the headers.
51- // convert each entry and remove the [] so its just numbers
52- z. := for_each(@to_string(), a.) - ']' - '[';
53- return(z.);
54- ]; //end to_cvs
46+ define[
47+ to_csv(a.)
48+ ][
49+ >> convert a stem., a., to csv (comma separated values) format.
50+ >> a. stem to be converted. Each element is a list and will be a line
51+ >> in the output.
52+ >> typical use is
53+ >> file_write(my_file, to_cvs(data.));
54+ >> E.g. here is the start of one
55+ >> a.0 := ['t', 'x', 'y']; // header
56+ >> a.1 := [0, .5, .345723445]; // first line of data
57+ >> tip: [['t', 'x','y']]~a. would stick in the headers.
58+ // convert each entry and remove the [] so its just numbers
59+ z. := for_each(@to_string(), a.) - ']' - '[';
60+ return(z.);
61+ ]; //end to_cvs
5562 /*
5663 To use this with gnuplot, go to a work directory (here I am using /tmp
5764 but you should create your own), and create
0 commit comments