Skip to content

Review: APL.68000 Level II

Vector 7:4, page 67

The text of this article is not yet online. No complete scan of this issue has been found. The only copy found, on vector.org.uk, is damaged: its page images are lost, but the text machine-read from them survives, shown below (help find a scan).

Unedited OCR text, machine-read from a scan now lost: it contains errors, and its APL is wrong. Shown for searching.

VECTOR Vol.7 No.4

APL.68000 Level IE

reviewed by Iain Hayward

Introduction APL is almost unheard of on home computers, even though a full specification interpreter has been available for years. When MicroAPL ported APL.68000 onto popular machines like the Macintosh, Amiga and Atari, it was pioneering the use of WIMP interfaces in APL, and it made APL available to almost everyone.

MicroAPL recently announced the release of APL.68000 Level IT, and renamed its original product as Level I. As an existing user of Level I for two years now on my Amiga, my only complaints the rather Hmited printer support, which I rectified using an auxiliary processor (Vector Vol.6 No.1, page 127), and the lack of nested arrays. Now it seems that MicroAPL has more than compensated for the latter problem by providing an upgrade which it claims is a superset of APL2. Although this review is based on the Amiga version, it concentrates on the machine-independent enhancements to the interpreter.

First Impressions Any doubts about it being worth the price begin to fade as soon as you remove the wrapping; the manuals and disk come respectable looking box file as befits a serious software product. An initial glance at the contents gives further reassurance that MicroAPL has not tried to skimp on production costs. Even the disk containing the software is of an unusually high quality.

Two sets of APL key stickers are provided, one for the standard APL keyboard layout and one for the alternative Unified layout. The stickers should be attached to the each key rather than on top; an arrangement that works very well in practice but is surprisingly awkward to install (this shouldn’t affect real APL ers, of course, who already know where all the symbols are!).

For those who don’t know quite where to start but are impatient to see their new purchase do something, MicroAPL has provided an automatic demonstration workspace which is quite impressive and inspiring.

67

VECTOR Vol.7 No.4

Documentation The package includes two conveniently sized A5 format manuals which stack well alongside copies of Vector and MicroAPL News. The first, thinner manual is concerned with system-specific information such as the user interface and access to features of the native operating system: graphics, windows, multi-tasking, etc. It is rather brief however, and doesn’t really do justice to the software it describes. It also Jacks an index.

The second manual however, the APL.68000 Level II Language Reference Manual, is superb. It is about two centimetres thick and ring bound so that it opens flat without one having to stand a on it. It was obviously written by someone who knows and loves APL, and if youve got this manual then you may not need to buy a copy of Gilman and Rose. More than a third of the manual is devoted to teaching APL, and MicroAPL’s experience in is clearly in evidence. There are convenient entry points for the complete beginner, for programmers who don’t know for programmers who know APL but are unfamiliar with this implementation. There is also advice for users who are upgrading from Level I. The reference section of the manual should serve as an example to other suppliers. It is very readable, and gives carefully selected examples of how a function or operator might be used, rather than just a dry, technical definition. worth mentioning that the manual was completely re-written for Level II, instead of just having a new section added.

New Features the enhancements to be found in Level II seem to have been added to provide compatibility with the APL2 standard. They arrays, mixed arrays, multiple and selective specification, vector notation, four new primitives, defined operators and extensions ones, and APL2-style error handling. Readers who are familiar with APL2 may wish to skip the next few sections and continue reading from the section on compatibility.

Nested Arrays All of the functions that [ had expected to see were there, together with a few that were new to me, All appear to conform to the APL2 standard.

1 found the Partition function particularly useful. It divides its right argument into an array of nested vectors according to the specification given in its left argument, which is a scalar or vector of zeros or positive integers. A new element

68

VECTOR Vol.7 No.4

is created in the result whenever the corresponding element in the left argument is greater than its predecessor, whilst a zero causes the corresponding element to be discarded. This can be used to good effect in text processing, where you might want to separate words into a nested vector. First identify all the non-space characters as a boolean, then use this as the left argument to Partition. As a bonus, all well as multiple spaces are removed

Enclose depth of its argument by one, producing a scalar. It has no effect on a simple scalar. It can be used with an axis specification to split and rearrange an array. Disclose used on scalar reverses the effect If the argument is a nested vector then the result will be a matrix, with rows padded as necessary with their elements’ prototype. Disclose can be used with an axis specification on higher dimensional arrays to rearrange the data. The shape of the result is derived from a combination of the shape of its argument and the shape of the items within the argument.

The Pick function lets you pick out an item from a specified position and depth within a nested array. First returns the first element of an array, or its prototype if it is empty, and is a little more flexible than 1 Take. Enlist has the effect of ravelling and catenating every item in its argument (removing nesting in the process) to produce a simple vector out of anything. Depth returns the depth (amount of nesting) of the deepest part of an array. Although a simple scalar has a depth of zero, for some reason a simple array is considered to have a depth of 1. Thereafter the depth increases by one for each level of nesting.

The powerful Each operator has been provided of course, which lets you perform an operation on each element of an array without the need for a loop. The system functions OCR, OFX, OSS and ODR have all been extended to support nested arrays, and utility function DISPLAY has been provided which displays the structure and contents of a nested array.

Mixed Arrays It is now possible to mix character and numeric data in array. I don’t think I would ever use this feature with simple arrays, but it is very useful with nested arrays where you might want to keep related data together, some elements containing numeric data and others character data.

Multiple and Selective Specification Multiple specification or assignment is permitted, allowing you to assign a vector to a list of variable names in brackets, each element of the vector being |

69

VECTOR Vol.7 No.4

assigned separate variable. It doesn’t seem to work on system variables though, and I find that the diamond separator makes this feature largely unnecessary, but it’s there for those who want it. Much more useful is selective specification, which makes it possible to assign to items deep within a nested array. The idea seems to be that if you can select it, then you can assign to it. There are some restrictions on the complexity of the expression used for selection, but I don’t think APL.68000 is alone in this.

Vector Notation Just as it has always been possible to create a numeric vector by entering a list of its elements, now it is possible to construct much more complex data structures in the same way. Each element can now be an array in itself, with parentheses and quotes being used where necessary to delimit the elements. This facility is particularly useful for constructing nested arrays.

Other New Primitive Functions The Index function (squad character) is also implemented, providing a more powerful and neater way to do indexing than using brackets and semicolons. It can be used with an axis specification. Match will test if its arguments are absolutely identical in every way. This function is a welcome addition because it is quite tedious to have to write such a test in APL. Find is a generalized search function. It behaves like the string search system function but its arguments can be of any rank and type. I like the Without function, and feel it should have been included in APL from the very start. It returns its right argument with all the items occurring in its left argument removed. It only works on vectors though, but they can be nested.

Extensions to Operators and Defined Operators Some of the most exciting enhancements to be found in the new product are still to come; operators can now be used with any primitive functions and with user- defined functions, so expressions such as ,/DATPA and MYFN/DATA are now valid. Furthermore, it is now possible to write your own operators, just like writing functions. The possibilities are enormous.

Error Handling Ina nutshell, APL.68000’s error handling functions are still there, and IBM’s error handling functions added.

70

VECTOR Vol.7 No.4

The new system functions are:

OFA Execute Alternate OFS Error Simulate OFC Execute Controlled O£Y Error Type OFM Error Message

This apparent duplication of functionality actually turns out to good thing. Apart from the obvious benefits of compatibility, the two sets handling functions are in fact complementary, since the existing functions provide error handling at the function level, while the new functions provide it at the statement level.

Other Enhancements The Overbar and Underbar characters can be used in object names, although not for the first character. Comments are allowed in function header lines, and spaces before comments are preserved (something I had wanted for a long time!). Ravel can now be used with an axis specification to new axis of length 1, or to combine a range of axes into one. Take and Drop can also be used with an axis specification to achieve Take and Drop along specified axes only.

Compatibility Level II is upwards-compatible with Level I with just three slight exceptions. The first and most important one concerns the indexing of numeric constants. The following expression:

42434 5f3]

would give a RANK ERROR under Level II because the index binds to the scalar immediately to its left. The second exception concerns object class codes as defined for the system functions QNL and (WC. Code 4 in Level I meant invalid name; now invalid name is -1 and 4 means user-defined operator. The third exception is simply that numeric arrays are now displayed with each column formatted separately. These differences won't cause any of your existing applications suddenly to start behaving differently, though. A system variable cs (compatibility setting) has been provided to cause the interpreter to behave like Level I for all or any combination of the above three cases, and it is automatically set to give full compatibility when you load a Level I workspace.

71

VECTOR Vol.7 No.4

I was particularly pleased to find that my assembler-coded auxiliary processor routines continued to function correctly. The original auxiliary processor interface (AP1) has remained the same, and just gives a DOMAIN ERROR when passed a nested or mixed array. A new AP interface (AP2) has been provided which will accept the new data structures.

MicroAPL has expressly stated that Level II is designed for close conformance with IBM’s APL2 standard, and while there are some divergences, it is MicroAPL’s intention to remove most of these in future releases. Even where Level Il is different from APL2/370, it is usually compatible with APL2/PC, and in some cases it is more compatible. Among the features still to come are complex numbers, N-wise reduction, format-by-example, axis on scalar functions and matrix arguments to the sort primitives.

Portability It has always been the case that a workspace saved on one machine can be loaded on any other machine running APL.68000, since the workspace format is identical. MicroAPL also claims that any workspace saved under Level I can be loaded under Level I, provided that the state indicator was clear when it was saved. You are warned however, that since the new interpreter is about 50K bigger, you may have less workspace available on single-user systems. So far, 1 have had no problems.

Due to the high degree of compatibility with APL2, it is now possible to move applications to and from APL2/370 and APL2/PC. This is achieved quite easily by using the system commands )0Uf and ) IN which create and read transfer files. How you move the files between machines is up to you, but you must ensure that no character translation takes place. There is also a system function called O7F which returns the transfer form of an object, or alternatively, decodes an object from its transfer form. The transfer form is a text representation that is suitable for transmission between dissimilar machines or implementations of APL.

System Limits Most of the limits seem absurdly generous, for example the maximum depth of an array is 100, and the largest number allowed is about 1.8E308. The only limits which might conceivably be a problem are the maximum rank of an array (8), the maximum length of a name (30 characters) and the maximum symbol table size (6,021 symbols).

72

VECTOR Vol.7 No.4

Performance I am not keen on benchmarks, preferring to judge for myself whether the performance system is acceptable, but I did once run some standard benchmarks on APL.68000 Level I on my Amiga and found it to be slightly faster than an IBM PC/AT running APL*PLUS/PC. I found the overall performance of Level I to be a bit slower than C code, but it saved me so much development time that I would never go back to programming in C. MicroAPL has certainly optimized the displaying of text; results are flashed up on the screen like lightning. So far, I have not noticed any degradation of performance when running my existing applications under Level II. { can see one reason why this is so: the internal structure of simple variables has not changed, only the new data structures are more complicated, and they have been given a new type code. On the occasions where I have been able to replace existing code with a nested array solution I have in fact achieved a considerable improvement in performance, not to mention simplified code.

Conclusion I have to conclude that Level II does everything that is claimed of it and, in the case of personal computer implementations, much more. The standard libraries provided with APL.68000 make it unbelievably easy to use the features of the native operating system; a single function call replaces many lines of quite difficult code and hours spent studying the reference manuals. There is even a terminal emulator included so that you can log on to remote APL systems. Now MicroAPL has enhanced its product to the standard of APL2 on a mainframe and made it portable as well. Alll this, together with a WIMP user interface that has to be experienced to be appreciated, would seem to make APL.68000 the obvious choice for anyone who wishes to do serious programming in APL.

73

VECTOR Vol.7 No.4

APL*PLUS/PC PostScript Support

notes by Adrian Smith

On page 70 of Vector 7.3, Jonathan Barman regretted his a PostScript printer, and hence his inability to test out the PostScript APL font shipped with APL*PLUS/PC release 10, Accordingly, 1 borrowed the review copy, and had a quick look at the font:

SJGKHZ~x WY . ETOQDMF [UN<I

57] 9B+PRVCAO/XL, ~o?L I -

1238464\270;20VT>?L* 9una <#<52=>)victaot:ef ovla

LVVAbRoeral ;\AeGANOAE=

abcdefghi jkl{}_HaiounN

mnoporstuvwxyzZif$Z&#"@ a-@ ¢ 6 Z«>cdoRf

Aesthetically, I’m afraid J don’t particularly like it; the whole font looks a bit big and heavy, and there is no variation in the character height (e.g. I think that symbols like [ | should show above and below the caps). It also bothers me that there is no attempt to be consistent about the overstruck symbols ... V jumps all over the place depending on what has been combined with it! None of the PC line-drawing characters are included, which I would find an annoying omission.

Speed of printing is a little slow (the font is encrypted which must slow it down), a typical function listing took 156 sec to print on GoScript, as against 32 sec using my APL-2741 font.

The good news is that if you want to use the Portl0 driver, you can easily substitute any other PostScript font which uses the same encoding, and the encoding is in plain text in the font definition (it looks like standard APL*PLUS/PC AY). For my part, I shall continue to work with my own font, trivially recoded to work with the APL*PLUS character encoding.

74

VECTOR Vol.7 No.4

RECENT MEETINGS

This section of VECTOR is intended to document the seminars given at recent meetings of the association; it is of particular value to members who live away from London. It also covers other selected events which may be of general interest to the APL community.

If you would like to speak at one regular British APL Association seminars, the Activities Officer (address on inside back cover) who will respond enthusiastically to your offer.

7