I'm a q newbie and am trying to write a csv save function
CSVsave:{[filename;table]
filename: $[-11h = type filename;filename;`$":", filename];
@[hdel;filename;()];
h: hopen filename;
(neg h) csv 0: table;
hclose h;
};
When I put this into a file IO.q and do
\l IO.q
I get an error message
k){0N!x y}
'{
@
"q"
"CSVsave:{[filename;table]\n filename: $[-11h = type filename;filename;`$\..
but if I remove the new line and put everything in one line
CSVsave:{[filename;table] filename: $[-11h = type filename;filename;`$":", filename]; @[hdel;filename;()]; h: hopen filename; (neg h) csv 0: table; hclose h;};
It runs fine.
Am I missing something obvious?
A space before the last parenthesis.
I'd also suggest trying a kdb IDE. Rather than having to continuously save load. e.g. qStudio