Oh, that's why my typed example didn't look like the one I copied. In any case, I find J's error handling very useful in that I seldom have to look at more than the single line in error to figure out what's causing it.
On 5/6/08, Roger Hui <[EMAIL PROTECTED]> wrote: > > > The use of a space character to indicate the exact location of the error > is > > a bit subtle, like many things in J. > > > It is less subtle than you stated as 3 spaces > rather than one are inserted at the point of error. > > > > > ----- Original Message ----- > From: Devon McCormick <[EMAIL PROTECTED]> > Date: Tuesday, May 6, 2008 7:08 > Subject: Re: [Jprogramming] RE: BegQ--Writing files with LFs not CRLFs? > To: Programming forum <[email protected]> > > > Harvey - > > > > to help you overcome these sorts of difficulties in the future, > > may I point > > out that J error messages are - initial appearances to the > > contrary - often > > very useful and specific? You may be able to diagnose > > problems more quickly > > if you pay closer attention to them. > > > > That being said, let me point out some conventions of these > > messages with > > which you may be unfamiliar. > > > > For example, in your recent message, you were stuck on an error > > like this: > > > > |domain error > > | (q ,LF)1!:2<'c:\q1.txt' > > > > There are very few error messages which seem to account for the > > bulk of > > errors people get. In this case, the "domain error" tells > > you that the > > arguments you are supplying to a function are outside its > > domain, i.e. of > > the wrong type. The second line of the error shows the > > offending statement > > with a space inserted at the point of error detection, i.e. "(q ,LF)" > > indicates that the concatenation is at fault. > > > > As > > Björn pointed out, this is because "q" is numeric but "LF" is > > character (and the domain of "," is homogeneous items). > > In general, J is has loose typing and only distinguishes between > > character,numeric, and boxed, so this simplifies the number of > > variations you have to > > consider in the case of a domain error. > > > > The use of a space character to indicate the exact location of > > the error is > > a bit subtle, like many things in J. > > I hope this helps. > > > > Regards, > > > > Devon > > > > On Tue, 06 May 2008 08:22:54 -600, PackRat <[EMAIL PROTECTED]> > > wrote:> > > > Bjorn Helgason wrote: > > > > (q,LF) 1!:2 <'c:\q1.txt' > > > > > > > > > and Ric Sherlock wrote: > > > > The verb fwrites (write a file as a string) takes the left > > argument> ... > > > Thanks, Bjorn and Ric, but... for whatever reason, using > > "fwrite"> doesn't seem to work, always giving errors--that's why > > I didn't include > > > it in my original examples. (I actually had tried all of these > > > "fwrite" variations before writing my original message, but because > > > none of them worked, I limited myself in that info request to those > > > forms that *did* work.) Here are results from your > > suggestions:> > > > Bjorn: > > > > > > (q,LF) 1!:2 <'c:\q1.txt' NB. your > > original suggestion > > > |domain error > > > > > > | (q ,LF)1!:2<'c:\q1.txt' > > > > > > > > > (LF,q) 1!:2 <'c:\q1.txt' NB. xchg x args > > > |domain error > > > | (LF ,q)1!:2<'c:\q1.txt' > > > > > > (q,LF) 1!:2 jpath > > ('~user\data\q1.txt') NB. variant file spec > > > |domain error > > > | (q ,LF)1!:2 > > jpath('~user\data\q1.txt')> ... > > > As you can see, I tried exchanging the "x" arguments, > > exchanging the > > > verb form between "fwrite" and "1!:2", and exchanging the "jpath" > > > syntax and regular syntax for the "y" arguments--but all to no > > avail.> I just could not get "fwrite" to work correctly. > > Any other > > > suggestions? Thanks! > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- Devon McCormick, CFA ^me^ at acm. org is my preferred e-mail
---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
