Hi Stefan, Hi factor list,

I added a with-delimiter word to the csv vocab which changes the field
delimiter used by the parser.
e.g.

.. <file-reader> CHAR: \t [ csv ] with-delimiter

You can pull the code from my git repo:

   git pull http://phildawes.net/2008/factor.git master

I'm not sure if with-delimiter is a good interface or not. The other
options were:

2. have csv and csv-row take a delimiter from the stack
3. have the client explicitly set the delimiter variable

(2) looks cleaner, but is less clean for the default case.
(3) exposes more internals but has the advantage that if the csv parser
is expanded with other options the interface doesn't change. N.B. I
noticed that the python csv parser has quite a few options so this is
likely to happen at some point.

What do you think? Is there a recommended 'factor-way' for handling
optional arguments to words?

Cheers,

Phil



Phil Dawes wrote:
> Hi Stefan,
> 
> Stefan Scholl wrote:
>> The definition of (csv) uses a hardcoded "CHAR: ,", which
>> prevents it from being used with the CSV output of the German
>> version of Excel.
>>
>> I know that a CSV with semicolon instead of comma is broken, but
>> when you tell someone to "just send a CSV" file, then you end up
>> with it. Reality is evil.
>>
> 
> I'll create a version that lets you specify the delimiter on the train 
> home from work. I'm guessing making it a variable may impact performance 
> (I'm using the module for importing large files) but then if that's a 
> problem I could always specialize a version for commas using a 
> compiler-transform or something.
> 
> Cheers,
> 
> Phil
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
> Don't miss this year's exciting event. There's still time to save $100. 
> Use priority code J8TL2D2. 
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Factor-talk mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/factor-talk
> 




-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to