C++ interface for csv loader/writer

23 views
Skip to first unread message

Zhuanhao Wu

unread,
Feb 1, 2016, 10:04:01 AM2/1/16
to SciRuby Development
I'm planning to implement a csv loader, but I have some questions that I can't answer before implement it.
1. Should I decide on dtype right in C++ code or just parse csv as string arrays then cast them in Ruby?
2. Can I assume that csv file is 'comma separated' ? I mean, in some case, csv files are separated by tabs or something else.
If the answer to the first question is 'no', the situation will be quite simple.
If the answers to the questions above are both 'yes', I may write up some flex codes(a parser generator) to parse the csv file.
But If the second is 'no', while the first is 'yes', things may be a little complicated, that I may have to write a DFA by myself.

John Woods

unread,
Feb 1, 2016, 10:14:44 AM2/1/16
to SciRuby Development
I think it would be best to rely on an existing CSV-reading library, and read it directly in C/C++ — deciding dtype as efficiently as possible.

I don't think you can assume comma separation. That's why it would be good to use an existing library — so you don't have to reinvent the wheel.

--
You received this message because you are subscribed to the Google Groups "SciRuby Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sciruby-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Zhuanhao Wu

unread,
Feb 1, 2016, 11:04:54 AM2/1/16
to SciRuby Development
Got it!
Thanks for your advice!
Reply all
Reply to author
Forward
0 new messages