Skip to content

The CIPS APL Toolkit (review)

Vector 6:1, page 51

reviews programming techniques

Transcribed from the printed issue; not yet reviewed. Read it in the PDF of the issue, page 51

The second edition is an enormous improvement over the first. It now contains a substantial number of APL functions which every APL programmer needs to have available when building systems. Newcomers to APL will find the book invaluable. Those who have been programming for some time will already have created most of the functions, but may find some useful items to add to their tool chest.

About 150 functions are included, most of them very short utilities, but there are some longer ones which are more general purpose. The functions are grouped into sensible classifications, and each function has an excellent explanation of how it should be used. The functions and explanations are in separate sections, each with its own index. Those who want to use the functions will probably want to read the explanations without looking at the code, and will approve of this arrangement into separate sections. It was, however, most aggravating to have to keep flipping between the sections to read the code and the explanation together while reviewing the Toolkit.

The quality of the functions is patchy, which indicates the wide range of sources for the code. The introduction states that ‘Optimal efficiency was not a requirement for initial inclusion in the collection, although many of the functions are efficient.’ On the contrary, a few of the functions are efficient but many of them are very inefficient. No indication is given in the description of the relative efficiency of the functions, nor is there an indication that there may be an alternative way of carrying out the same task. For example, the function FIRST contains Y←(X⍳X)=⍳⍴X and Y←∨/<⍀X∧.=⍉X for the vector and matrix case respectively, but there is no indication that these algorithms work well for small arrays but are very inefficient for large arrays. The alternative sorting algorithm suitable for large arrays is not mentioned. The methods for writing efficient APL code have been published, in particular Roy Sykes’s Whizbangs and Gary Berquist’s Advanced Techniques and Utilities, so there should be little excuse for missing out this aspect.

There are 24 categories of functions, covering catenation, date manipulation, formatting, graphics, input, output, programming, searching, sorting, text editing and timing. Each category has a brief description of its contents in the introduction, and there is a listing by category of the header and first comment line of each function. The indexes for the function section and the explanations section are both by category and alphabetically by function name.

The coverage is quite good, with date manipulation, searching and sorting being well represented. The most notable omission is the formatting of numbers. The ‘formatting’ category supplies functions to help with writing reports, left/right justification, centering, column headings etc., but nothing for adding the usual decorations to numbers such as commas or brackets round negative numbers - usually a substantial number of functions are required for VSAPL users who do not have ⎕FMT or the extended formatting capabilities in APL2. VSAPL comes with a formatting workspace, so perhaps it was assumed that everyone has access to suitable numeric formatting functions.

A set of skeleton output functions is provided which are designed to be used in a consistent way to output reports for an application. There is a good explanation (in an appendix) of how sets of device-dependent functions can be bolted on as required, and suggestions are made for various extensions which would be necessary to make them work properly. Comments are included such as ‘CLOSE PRINTER AS REQUIRED (INSERT CODE HERE)’, but the sections relating to files are not well commented, and people who are not familiar with shared variables could find this aspect quite difficult to write. It would have been useful to have had a worked example in a particular flavour of APL.

The original collection of functions for the Toolkit was made in the early 80’s, when the majority of APL was carried out with typewriter style terminals on a timesharing bureau. The input, text editing, and graphics functions have been included in the second edition with little change, and are still geared for typewriter terminals. It was quite a nostalgic experience to see them again, and to remember what it was like without today’s full-screen capabilities. Utilities for full-screen work are entirely absent, understandably perhaps as each of the flavours of APL provide such different facilities that it is difficult to provide a coherent set of useful functions, particularly ISO standard-conforming functions.

A few APL idioms and boolean techniques are included in an appendix. The reader is referred to the Finnapl Idiom Library and to Robert Smith’s Boolean Functions and Techniques, which presumably provided the source for all the examples given.

There is a workspace associated with the Toolkit, but it is not being distributed by the CIPS APL SIG. It is not clear what is in the workspace, or whether the explanations are included as well as the functions. Also the flavour of APL, or the medium on which it is available, is not stated. Perhaps I-APL should get into the act!

The manual is spiral-bound in flimsy covers, and will get rather tatty after a little use. The function explanations are all in APL upper-case script, which is not very easy on the eye. The introduction is in a pleasant proportionally spaced font, but there appeared to be some difficulty mixing APL with ordinary text: a right arrow came out as a splodge.