APL.68000 (SYMBOLIC)
BY HOWARD OAKLEY
MicroAPL Limited
Unit 1F, Nine Elms Industrial Estate,
87 Kirtling Street,
London SW8 5BP, England.
Spencer Organization
P.O. Box 248
Westwood, NJ 07675
(201) 666-6011
$275.00
Since APL was first devised and then put onto IBM mainframes by Ken Iverson and colleagues in the early 1960s, it has attracted a small but devoted following. Enthusiasts recognize it as a language ahead of its time; often, in fact, as the very antithesis of most modern computer languages. APL deals with variables, including scalars, vectors, or arrays of many dimensions, in such a dynamic way that there are no type or range declarations - the variable X could in the same line be a character matrix, then a real scalar, and next a 4-dimensional Boolean array. Program development is surprisingly quick, since APL is an interpreted (not compiled) language. It combines terse code with a very high level of access to the machine. You can sort a character string in but a few APL symbols, and invert a numeric matrix in just one symbol.
This terseness, and the fact that APL draws its symbols from Greek and mathematics rather than the ASCII set, makes programs very hard to read, sometimes difficult even to an expert. However, after a few weeks of learning the language, most people can write functional code. A good ST APL should use GEM fully, combining its graphics and friendly interface with APL's power and speed. Let's examine how well MicroAPL's APL.68000 has achieved this.
IMPLEMENTING THE LANGUAGE
The established "core" standard for APL is IBM's APL.VS. APL.68000 is a much-enhanced superset of the standard. The core of APL.68000 has now been implemented on almost all 68000-based machines. It has the reputation of being one of the fastest interpreters around - and benchmarks are much the same on all 8 MHz machines: a good deal faster than the IBM PC AT, but a little slower than a Vax and the IBM PC RT, although trigonometric functions are not as fast as on an IBM with a 8087 math coprocessor. Floating point math in APL.68000 is all IEEE 64-bit, so numeric accuracy is hard to beat. Over the last few years, I have accumulated a large number of workspaces, running under IBM PC APL. Many of these were typed straight in from mainframe listings. My acid test of the core of APL.68000 was to port these over to the Atari. I used Michtrori's superb DFT to actually carry out the transfers, then a few lines of simple APL to perform the final character translation. After a few minor modifications, all my existing code ran superbly.
Figure 1 shows the full-screen function editor in use, and friendly GEM features which make life a lot more productive. APL.68000 uses GEM sensibly to make learning APL much safer and easier. The interpreter and APL programs run in any of the three ST resolutions available.
Since APL is an extensible language like Forth, it is easy to provide functions to carry out additional tasks. Alternatively, you can load additional code through an assembled or compiled program interfaced with APL by an Auxiliary Processor. APL.68000 offers this for those who wish to add their own extras, and the manuals document it carefully. Additions can also be made to the language, usually in the form of "quad" functions, and MicroAPL has provided a full range of the more useful ones, from Fortran-like formatting to the stripping of leading and trailing blanks. Finally, to the horror of purists, you can actually add more APL symbols.
In the interest of protection, APL.68000 does not have PEEK- and POKE-like instructions to allow memory and machine code access. This inability makes access laborious to GEM functions not provided with the package, requiring you to write code that interfaces through the Auxiliary Processor.
APL.68000 running on a 1040 has a total workspace of up to about 740K-without any desk accessories-well above the customary memory size. You can casually invert 100 x 100 matrices in floating point, or strip blanks from book-length documents. If you are hungry for speed and memory, you'll get satisfaction here.
THE ENHANCEMENTS
APL.68000 for the Atari ST comes with one single-sided disk (without copy protection), a generic manual for the language itself (a thorough reference with excellent tutorial sections), and a slim blue manual covering the ST-specific enhancements. There are six additional workspaces to enable:
- Full use of the ST disk filing system, including extensive error-reporting;
- Reading the mouse and keyboard, support for the clipboard, function keys, input/output via serial and parallel ports;
- Full control of the menu-bar to provide completely GEM-based menu-driven applications;
- Support for extensive dialog facilities and easy use of alert boxes;
- And almost the full complement of GEM graphics and text-drawing functions, even down to program control over colors in the palette.
LIMITATIONS
APL.68000 has two problems you should be aware of. First, the lack of support for printing out APL symbols. I have an IBM Graphics Printer, which my IBM PC APL switches into graphics mode to print out the full APL character set. Although some printer support is provided, APL.68000 seems unable to cope with this, and the only way that I can get function listings at present is to dump the screen with the Alt-Help function. (MicroAPL should soon provide printer drivers for Epsons and the like.) I should stress that this only applies to non-ASCII characters and should not affect an end-user of APL programs.
The second problem is the keyboard arrangement. Since traditional APL uses so many non-standard characters, MicroAPL has provided an APL keyboard configuration, together with keytop stickers. Again, an end-user can be protected from this. As a function you can switch in and out of normal keyboard configuration, and the Control-Tab key combination will do the same interactively. Many people rebel against APL's strange keyboard arrangement, and opt for keywords in place of symbols. Spencer Organization offers APL-Keyword for those who prefer a clean keyboard.
PROSPECTS
In statistics, engineering and other scientific math, APL has few rivals. If number-crunching is your life, then get APL.68000 for the ST. However, many others could benefit from its use. If you have to get a sizeable project completed in very short time, or want to produce code that will only be used a few times, the development time saved by using APL will more than repay your effort in learning it. I use APL to produce prototype programs, or explore algorithms, before coding in other languages (such as Modula-2). It is also easy to produce language emulators in APL, so that you can code in your chosen (compiled) language, and test, refine and debug interactively in APL before running the compiler.
A few years ago, finished products in APL were few. However, APL.68000 on the ST can offer you the facilities for a completely professional product-GEM-based, with high quality. When you consider the relative cheapness of the hardware and the interpreter needed, it is a very realistic proposition for both programmer and customer. In short, I am delighted with it.
(Editor's note: For more timely reviews of ST products, from arcade
games to hardware, see The ST Resource, appearing every month in Antic
Magazine.)
A SHORT
HISTORY OF APL BY PATRICK BASS The computer language APL (A Programming Language) was first developed by Kenneth F. Iverson, while he was teaching at Harvard University in the l950s and early 1960s. It is a procedure-oriented language, like Pascal or Fortran, insofar as it allows the descripition of procedures used for solving problems. However, APL breaks tradition with Pascal and Fortran by allowing the user to interact in real time with the language. For example. if we type "2+2" into APL, it responds almost instantly with the answer "4". whereas the other two wont. The plus sign acts as an operator which signals APL to take action. It is also possible to write procedures which are called by other procedures, and which act on previously stored or generated data. Don't class APL with BASIC because its interpreted. however APL is a very powerful language, having operators that perform actions requiring many statements in other languages. This way a beginner can get started with APL within minutes, and yet still have access to the powerful set of APL operators. The power in APL comes from its use of arrays as the basic data element, and a set of operators of remarkable scope for manipulating arrays. All functions which operate upon scalar variables operate in both monadic and dyadic form. This means an operator applied to a single argument may give different results when applied to an argument on either side of itself. For example, the operator which normally returns the largest of two values will, when applied to a single value, return the largest integer which is smaller than or equal to the argument. One odd feature of APL is that there is no "operator hierarchy." as there is with other languages. Assuming no parenthesis are used, expressions are always evaluated right-to-left. In the following example, 3 X 2+ 3 will equal 15, not 9. APL was originally designed to be operated from remote terminals having little or no local memory, so I/O structure in APL has been historically weak. However, recent applications of the language take care of the problem admirably. APL.68000, for example, uses the TOS interface fully. APL has attracted many supporters. There are versions of APL for nearly every machine capable of running it; from IBM mainframes to our beloved ST. You'll find many' people who will defend APL to the death, but can't explain why. (Similar to, say, the supporters of Forth.) APL. like Forth. tends to be indecipherable to the unwary reader, and divides the people who come into contact with it into two camps-you either love it or hate it. |