ect: Re: [Jprogramming] Beginner Understanding CSV file reading/writing
>
> Just to gild the lily, one of our NYCJUG members implemented CSV parsing
> using J's finite-state machine primitives:
> http://www.jsoftware.com/jwiki/NYCJUG/2013-06-11?action=AttachFile&do=view&target=Pa
lf Of Devon McCormick
Sent: Tuesday, December 10, 2013 10:34
To: J-programming forum
Subject: Re: [Jprogramming] Beginner Understanding CSV file reading/writing
Just to gild the lily, one of our NYCJUG members implemented CSV parsing using
J's finite-state machine primitives:
http://www.jsoftware
for the replies. It's going to take a while to take all this in.
>
> Regards,
> Jon
>
> > Date: Tue, 10 Dec 2013 11:38:30 -0500
> > From: devon...@gmail.com
> > To: programm...@jsoftware.com
> > Subject: Re: [Jprogramming] Beginner Understanding CSV file
>
Thanks for the replies. It's going to take a while to take all this in.
Regards,
Jon
> Date: Tue, 10 Dec 2013 11:38:30 -0500
> From: devon...@gmail.com
> To: programm...@jsoftware.com
> Subject: Re: [Jprogramming] Beginner Understanding CSV file reading/writing
>
> You m
You may also want to look at this:
http://www.jsoftware.com/jwiki/NYCJUG/2012-12-11#Example_of_Free-Form_Text_Wrangling.
On Tue, Dec 10, 2013 at 11:34 AM, Devon McCormick wrote:
> Just to gild the lily, one of our NYCJUG members implemented CSV parsing
> using J's finite-state machine primitives
Just to gild the lily, one of our NYCJUG members implemented CSV parsing
using J's finite-state machine primitives:
http://www.jsoftware.com/jwiki/NYCJUG/2013-06-11?action=AttachFile&do=view&target=Parsing+CSV+Files+with+a+Finite+State+Machine.pdf.
On Tue, Dec 10, 2013 at 9:35 AM, Joe Bogner wro
Just to expand on Devon's post, I often use a combination of cut and each
to split up a string
This will do the same (with a few more steps behind the scenes)
> ',' cut each LF cut ('1,2,"embedded comma",3.4',CR, LF,'5,6,"no
comma",7.8',CR, LF) -. CR
as
<;._1&>',',&.><;._2 CR-.~('1,2,"embedded
Yes - sorry for typing it in w/o testing it. Note that the point at which
the error was picked up is indicated by extra spaces in the returned line:
mat=.<.; _1&>',',&.><;._2 CR-.~freads jpath'~temp/test.csv'
|domain error
| mat=.<.;_1&>',',&.><;._2 CR-.~freads jpath'~temp/test.csv'
A go
It looks like there is a typo in command with `mat`: .; should be ;. .
'mat` is not a verb but a noun, btw.
I think tilde is a dyadic tilde, not monadic and swaps the arguments of -.
in this case.
On Sat, Dec 7, 2013 at 9:08 AM, Jon Hough wrote:
> I'd like to thank everyone for replying.
> I s
rd for support.
I would really appreciate any help at all in deciphering this.
Thanks and regards,
Jon
> Date: Sat, 7 Dec 2013 08:16:47 +1300
> From: tikk...@gmail.com
> To: programm...@jsoftware.com
> Subject: Re: [Jprogramming] Beginner Understanding CSV file reading/writing
>
&g
Yes thanks - auto correct strikes again!
On Dec 7, 2013 7:55 AM, "Devon McCormick" wrote:
> Ric, of course, means LFs on Linux versus CR-LFs on Windows.
>
>
> On Fri, Dec 6, 2013 at 1:53 PM, Ric Sherlock wrote:
>
> > The 45 that was output refers to the number of bytes written. The
> > differenc
The strings script is combined as part of stdlib since J7. In J602, which
Jon is using, the strings script was still separate (and had to be
explicitly loaded to be available in a session). The SVN logs suggest the
chopstring verb was added to strings in September 2008. I suspect that is a
later ve
Ric, of course, means LFs on Linux versus CR-LFs on Windows.
On Fri, Dec 6, 2013 at 1:53 PM, Ric Sherlock wrote:
> The 45 that was output refers to the number of bytes written. The
> difference between 45 and 47 is likely due to the LF line endings on Linux
> vs CRTs on Windows.
> I think the e
The 45 that was output refers to the number of bytes written. The
difference between 45 and 47 is likely due to the LF line endings on Linux
vs CRTs on Windows.
I think the error you are getting regarding chopstring is because you have
an old version of the base library. That verb should be defined
Also, I see "chopstring" defined in ~system/main/stdlib.ijs. I'm not sure
why the csv code doesn't find it.
On Fri, Dec 6, 2013 at 1:39 PM, Devon McCormick wrote:
> You can read CSV files in J pretty simply without using any predefined
> verbs like this:
>
> mat=. <.;_1&>',',&.><;._2 CR-.~fre
You can read CSV files in J pretty simply without using any predefined
verbs like this:
mat=. <.;_1&>',',&.><;._2 CR-.~freads jpath '~temp/test.csv'
But this does not properly handle cases where the delimiter is embedded in
a string, e.g. a file like this will cause problems:
1,2,"embed, comma",
I am a complete beginner to J. I am attempting to write and read CSV files.
My initial attempt is to follow this method:
http://www.jsoftware.com/jwiki/Addons/tables/csv
I am using J-602 on 32-bit Linux.
My attempt has some differences to the output shown in the example.
dat writecsv jpath '~tem
17 matches
Mail list logo