>  maximum line length for entering J sentences into the interpreter?

For immex, 1024 bytes.  This includes the leading 3 spaces (if present) but not 
the trailing line terminator (I'm not sure line terminators are ever actually 
in the buffer after you you press enter in immex).  

For scripts, I haven't hit a limit.

>  I can't seem to easily find this in the documentation: 

It's not in there.  I found the immex limit the hard way:

    http://www.jsoftware.com/pipermail/general/2002-June/009131.html

Well, actually, that was a long time ago.  Maybe it's changed since then? 

           NB.  Ensure that long lines are at least
           NB.  displayed to their full precision,
           NB.  to eliminate truncation as a source
           NB.  of error.   
           9!:37 ] 0 _ 0 _

           NB.  Create a long line of executable J.
           'x',~1023#'9'
        999999999999999999...x

           NB.  Put cursor on long line, press enter twice
        999999999999999999...x
        999999999999999999...

           NB.  Everything is fine
           
           NB.  Note that 1023 nines + a trailing x
           NB.  is 1024 bytes (assuming ASCII).
           >./#;._2 wd'sminputlog'
        1024
           
           NB.  Now try bumping it above 1024
           'x',~1024#'9'
        999999999999999999...x

           NB.  Again, put cursor on long line, press enter twice
        999999999999999999...x
        _
           NB.  The result is  _  because the trailing  x  was truncated,
           NB.  so the number wasn't interepreted as an extended integer.

           NB.  Our suspicions confirmed:  1024 nines + trailing x
           NB.  is 1025 bytes, but the input log still only
           NB.  reports a max of 1024.  The last char (the x)
           NB.  never made it to the engine.   Immex must've
           NB.  truncated it.
           >./#;._2 wd'sminputlog'
        1024

           NB.  Now, to make J crash, press CTRL+SHIFT+UP twice or
           NB.  put cursor on last long line and press CTRL+R
        
Of course, if you're typing 1024-byte long lines into immex, you have bigger 
problems than truncation (or maybe you're using Unicode ;).  I just happened to 
find this bug while attempting to debug a script line by line with CTRL+R.

Oh, on that point:  I'll reiterate that this is only a limitation if immex 
(i.e. the IJX window).  I have not encountered such a limit in scripts (i.e. 
IJS windows, or arguments to  0!:  ).  Though, amusingly, while writing up this 
post, I found a limit on immex *output*:  even though I set  9!:37 ] 0 _ 0 _  , 
output lines are still truncated (to 3067 bytes, it seems).

-Dan

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to