Will 33137706c2 pattern matcher | 4 månader sedan | |
---|---|---|
.. | ||
README.org | 4 månader sedan | |
csv.k | 4 månader sedan |
A simple comma separated value parser for ngn/k. Currently it uses hard-coded (easily modified) variables for the escape character and row and field separators.
It also currently works on the whole file as that's the typical way to interact with files in ngn/k. It shouldn't be too hard to make it work on blocks of bytes by first splitting on the "true" (i.e. not quoted) row separators and parsing all but the last leaving it (possibly incomplete) row to be prepended to the next chunk.
Also, it does no transformations on the data whatsoever currently. It simply splits on rows and fields while respecting quoting. Data can be cast to appropriate types as post processing, possibly with a well defined API as that used by kx.
This was pretty much my first K program ever, though it's gone through a few iterations. I originally wrote this in kona. (You can follow the iterations in that thread.) Later ColTim punched it up some after doing some performance testing on it.