compiler.k 495 B

123456789101112131415161718
  1. / csv parser - e exclusive
  2. getrange: {[str;s;e] s_(e-1)#str};
  3. lines: 0: "tempST.csv";
  4. /csv parser
  5. parsel: {[l] comi: &l=",";comi+:1;r: 2':!#comi;r: comi@r;r: (1 2#(0;r[0;0])),r;getrange[l].'r}
  6. parsel'lines
  7. / / how the parser works
  8. / t: lines[0];
  9. / comi: &t=","; / commas idx
  10. / comi+:1; / help exlude commas (later use -1 on upper)
  11. /
  12. / r: 2':!#comi; / ranges of comma separated parts
  13. / r: comi@r; / apply ranges to comma idx
  14. / r: (1 2#(0;r[0;0])),r; / add 0-first comma range
  15. / getrange[t].'r