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!
>
> Harvey
>


-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to