[comp.lang.apl] Dyalog APL questions

jph@suns.UMD.EDU (J. Patrick Harrington) (09/07/90)

    I  have  recently  obtained Dyalog APL for one of our  Sun  4 
computers,   and  it  is  indeed  an  impressive  implementation, 
especially  after  limping  along with a  bug-ridden  version  of 
APL\11.  One  of  the problems with APL is that it seems to be  a 
universe  unto itself,  and little consideration is given to  the 
possibility of interfacing it with other languages/data sets that 
may reside on the system. One great feature of Dyalog APL is that 
interaction possible using "Auxiliary Processors"; in particular, 
the  'unixfiles' AP lets you read a native unix file outside  the 
APL workspace.
    I  very  soon found that I wanted to make  some  calculations 
based  on some data sets - columns of floating numbers - which  I 
had  in non-APL files on the system,  and I surely didn't want to 
type them in.  Well,  'unixfiles' would read them in,  but in the 
form of nested arrays of characters.  I could disclose and decode 
the  strings of characters to get numeric data - but  then  there 
were  the  '-'  signs!  Another AP called 'xutils'  contains  the 
function  'ss'  which searches out and replaces  strings.  So  we 
replace each '-' with the high minus,  and the 'e's with 'E's. So 
I  wrote  a little function that reads in a named unix  file  and 
turns  it  into a APL numeric array.  But it still hangs  on  the 
occasional '0.000E+00' it may find in the unix file.   
    I would think that reading lists of numbers from files  would 
be  such a basic need that others must have solved this  problem. 
Is there some neat way to do this?
    Another  question  for  those who may be  using  Dyalog:  Our 
printers  are  Apple LaserWriter II's,  which isn't  one  of  the 
supported  printers.   Does  anyone  have  experience  with  this 
combination? 
                                       J. Patrick Harrington
                                       jph@astro.umd.edu

sam@ss_csi.jpl.nasa.gov (Sam Sirlin) (09/08/90)

(mail bounced, so I'm posting this)

I have had occasion to transfer data between Promatlab on VAX/SUNs to 
STSC's APL/PC. I read in the data as characters, then substitute

  -  high minus
  D  E           (double precision on VAX)
  e  E           (SUN exponents)
  +  0

and then can execute the variable to obtain numerical data.

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



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

clark@doggerel.gg.caltech.edu (Clark Brooks) (09/08/90)

In <7258@umd5.umd.edu> jph@suns.UMD.EDU (J. Patrick Harrington) writes:


>    I would think that reading lists of numbers from files  would 
>be  such a basic need that others must have solved this  problem. 
>Is there some neat way to do this?

And you call yourself an APL programmer.
--
clark@csvax.cs.caltech.edu
Neuro-linguistic programming is simply the zig-zag and swirl of menorgs and
disorgs acting under the suction and pressure of the morphogenetic field.
		-- Knowledgian maxim

rjfrey@kepler.com (Robert J Frey) (09/10/90)

In article <7258@umd5.umd.edu> jph@suns.UMD.EDU (J. Patrick Harrington) writes:
>
>...One  of  the problems with APL is that it seems to be  a 
>universe  unto itself...One great feature of Dyalog APL is that 
>interaction possible using "Auxiliary Processors"...

Other implementations of APL have similar facilities, but only APL2's
quadNA is comparable in ease of use and flexibility to Dyalog's
quadSH. We regularly run 16 Mbyte workspaces on Sun 4's with excellent
performance and make heavy use of AP's to improve efficiency  and 
integrate APL with other applications.

I've also found the code quite transportable. It took two programmers
less than two weeks to transport an application consisting
of thousands of lines of both APL and C from Xenix on 386's over to
Sun 4's. 

>[...description of application deleted...] I would think that reading lists
>of numbers from files  would be  such a basic need that others must have 
>solved this  problem. Is there some neat way to do this?

From what you describe the simplest thing would be to write an awk program
to fix the format before bringing it over to APL! :-)

As far as doing it within APL itself, I can offer two suggestions: First, use
'ss' to make the substitutions, eg, '-' -> negative-sign,  'e+' to 'E', etc.
then do an 'execute foreach' on the nested character string. Second, 
encapsulate this stuff into a utility function and stick it somewhere everyone
can get at, eg, a LOCAL.UTIL workspace in a lib directory like /usr/lib/WS or
whatever convention you use at your site.

If it's not clear how do this to all the character vectors
in the nested vector in one fell swoop, then figure out how to do it to a
single simple character vector, put it in a function, then apply the function
with a 'foreach' across the vector. This may work better if there is some
messy formatting problems or alot of case-by-case reasoning required.

>    Another  question  for  those who may be  using  Dyalog:  Our 
>printers  are  Apple LaserWriter II's,  which isn't  one  of  the 
>supported  printers.   Does  anyone  have  experience  with  this 
>combination? 

I would try contacting Dyalog if nothing comes in off the net. Sorry I can't
help with this one.

>                                       J. Patrick Harrington
>                                       jph@astro.umd.edu


-- 
Dr. Robert J Frey, Kepler Financial Management, Ltd.
rjfrey@kepler.com *or* frey@chaos.sunysb.edu
voice: (516) 689-6300 * fax: (516) 751-8678