Newsgroups: comp.lang.apl
Path: watmath!watserv1!utgpu!news-server.csri.toronto.edu!torsqnt!tmsoft!itcyyz!yrloc!rbe
From: rbe@yrloc.ipsa.reuter.COM (Robert Bernecky)
Subject: Re: Formatted Input in APL
Message-ID: <1992Mar25.151335.6536@yrloc.ipsa.reuter.COM>
Reply-To: rbe@yrloc.ipsa.reuter.COM (Robert Bernecky)
Organization: Snake Island Research Inc, Toronto
References: <1992Mar23.184729.10060@gmuvax2.gmu.edu>
Date: Wed, 25 Mar 92 15:13:35 GMT

In article <1992Mar23.184729.10060@gmuvax2.gmu.edu> ccoleman@gmuvax2.gmu.edu (Chuck Coleman) writes:
>I would like to know if anyone has developed functions for accepting
>formatted input into APL, similar to []FMT.  I could also use the IP
>address (numberic) of watserv1.waterloo.ca

SHARP APL (and later STSC) have []fi and []vi, which perform character to
number conversion, and character validation, respectively, according to
APL's rules for number conversion: No control is possible over the
flavor of conversion. For example,  '0.5  4j6   -5'

will be converted to: a float, a complex number (SHARP APL only -
I don't think STSC has complex math yet) and an illegal (wrong sign!).

Gert Osterburg and I have a paper "Compiler Tools in APL" which will
appear in APL92 ACM SIGAPL Quote Quad. One of the functions we 
describe is a Finite State Machine primitive, in which you can
easily build customized, highly efficient character-number converters.
For a simple converter which handles "COBOL"-style numbers
(Optional +- for signs; float or integer only; no "1e4" or "3j6"),
the FSM is a 4 by 15 table.  Performance is quite good, being on the
order of half the speed of the highly-optimized (In SHARP APL -
no sure about the vintage of STSC code) []fi.

IBM APL2 has something similar to []fi, which I believe is implemented
using []na, as a distributed utility. I don't have any details handy;
sorry.

Bob





Robert Bernecky      rbe@yrloc.ipsa.reuter.com  bernecky@itrchq.itrc.on.ca 
Snake Island Research Inc  (416) 368-6944   FAX: (416) 360-4694 
18 Fifth Street, Ward's Island
Toronto, Ontario M5J 2B9 
Canada
