This won't work if the comment text itself contains a quoted string "foo", because then Phil's code simply returns "foo" as the content of that line.
Slava On May 6, 2008, at 8:37 AM, Stefan Scholl wrote: > Or the application just ignores every row with the first field > starting with "#". > > > "123,456,789\n#stuff\n111,222,333" <string-reader> csv > [ first "#" head? not ] filter . > { { "123" "456" "789" } { "111" "222" "333" } } > > > ! Or: > > : process-row ( seq -- n ) > dup first "#" head? not > [ 0 [ string>number + ] reduce ] > [ 0 ] if ; > > "123,456,789\n#stuff\n111,222,333" <string-reader> csv [ process- > row ] map . > { 1368 0 666 } > > > Slava Pestov <[EMAIL PROTECTED]> wrote: >> This would be a good approach if the csv parser had an alternative >> entry point taking an array of strings. >> >> Then I could do >> >> "foo.txt" ascii file-lines [ "#" head? not ] filter csv-lines >> >> Slava >> >> On May 6, 2008, at 1:20 AM, Stefan Scholl wrote: >> >>> I haven't seen comments in any csv documentation so far. This >>> kind of in-band signalling should be handled by the application >>> itself and not by the library. >> >> ------------------------------------------------------------------------- >> 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 > > > -- > Web (en): http://www.no-spoon.de/ -*- Web (de): http://www.frell.de/ > > > ------------------------------------------------------------------------- > 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 > Factor-talk@lists.sourceforge.net > 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 Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk