Newsgroups: comp.lang.apl
Path: watmath!watserv2.uwaterloo.ca!torn!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!jato!csi!sam
From: sam@csi.jpl.nasa.gov (Sam Sirlin)
Subject: Re: Change in the effect of (1!: 1) 1 in J 6.2
Message-ID: <1993Jan15.175311.28997@csi.jpl.nasa.gov>
Originator: sam@kalessin
Sender: usenet@csi.jpl.nasa.gov (Network Noise Transfer Service)
Nntp-Posting-Host: kalessin
Organization: Jet Propulsion Laboratory, Pasadena, CA
References:  <memo.865808@cix.compulink.co.uk>
Date: Fri, 15 Jan 1993 17:53:11 GMT
Lines: 53


In article <memo.865808@cix.compulink.co.uk>, pmoore@cix.compulink.co.uk (Paul Moore) writes:
...
|> Unfortunately, it appears that this technique does not work any more in J
|> 6.2. Nowadays, (1!:1) 1 appears to read from the keyboard, always, and never
|> from the currently executing script. This is a real pain - would it be
|> possible, either to reinstate the old behaviour (I am tempted to describe
|> the change as a bug) or to provide an alternative means of obtaining the old
|> behaviour?

Still works ok for me using J6 (October) on a sun. You should check
the Status file that usually comes with the distribution and lists
changes from previous versions.

|> On this note, I find the file reading verbs in J somewhat odd. (1!:1) reads
|> a single line from the keyboard, when given an argument of 1, but reads the
|> WHOLE FILE when given a filename argument. It would be useful to have some
|> way of reading a file line by line. I realise that this would probably
|> involve some form of open/close file verbs, and a way of representing open
|> file "handles" in J, but I do believe that some way of doing this would be
|> useful.

It might help the developers if you mentioned a concrete example. Do
you want to read line by line because the file is too big to fit in
memory at once? If not, then you can just read the whole thing in and
cut at lf's:
   
   lf=. 10{a.
   split=. <;._1 lf, raw_read_data

|> On a final note, while I am talking about file handling, is there any way of
|> stopping screen output in a script? At startup, J executes the sequence
|> (0!:2 <'profile.js'). However, if profile.js is large, I would prefer not to
|> see it all on the screen. Can I stop the screen display (like 0!:3) -
|> preferably suppress the display at one point, and restart later. I can't use
|> the left argument of (0!:2) or (0!:3), as this would start a new script,
|> which is not what I want - I want to change the output destination WITHIN
|> the current script.

It's pretty easy to do if you just break up the file into those you
want to see, and those you don't, and in profile.js call them by
either 0!:2 or 3 as appropriate. In the interests of modular coding
this is probably better anyway. 

I always modify J to read from a single profile.js in sam/J, and in
that define a lib function that will silently loads whatever library I
want at the time (graphics, math functions, character manipulation,
etc.).

-- 
Sam Sirlin
Jet Propulsion Laboratory         sam@kalessin.jpl.nasa.gov

