Classic Computer Magazine Archive START VOL. 1 NO. 4 / SPRING 1987

CAMBRIDGE LISP
FROM METACOMCO

AT LAST, AN Al PROGRAMMING
ENVIRONMENT FOR THE ST!

REVIEWED BY
CHRISTOPHER F. CHABRIS
CONTRIBUTING EDITOR

Cambridge Lisp
Metacomco
5353 No. E Scotts Valley Rd.
Scolts Valley CA 95066
(408) 438-7201
$199.95

The Atari ST's move into the Artificial Intelligence (Al) field has awaited the proper tools, such as Lisp and Prolog language environments. For over a year, David Betz's public-domain XLisp interpreter was the only choice (see "The Al Apprentice: Explore Expert Systems with XLisp," START, Fall 1986). OSS's long-awaited Personal Prolog is still held up as of this writing.

However, Metacomco has made a strong effort to remedy the situation by releasing the Cambridge Lisp package. While Cambridge Lisp is by no means the ideal Al programming environment, it is a solid ST product with many welcome features to recommend it.

Cambridge Lisp is a comprehensive Lisp package, including an interpreter and a compiler, an editor, and a 350-page manual. Metacomco's GEM-based shell program, MENU+, ties the package together, providing access to various applications through drop-down menu selections. (Editor's note: a review of MENU+ appeared in issue three of START, Winter 1987.) A collection of utilities for deleting, renaming, and cataloging files is thoughtfully provided for use with the shell. It is even possible to customize the shell menu should you be unhappy with the supplied configuration. I must admit I did not find the shell as convenient to use as my favorite command-line interface (Micro C-Shell), but it is a useful inclusion for those who prefer a mouse interface to their development tools.

BACKGROUND

Cambridge Lisp is a dialect of the Lisp programming language. Lisp (for LISt Processor) was invented in the late 1950s by John McCarthy and his associates at Stanford University. Cambridge Lisp is an extended version developed at Cambridge University, originally for the purpose of research into symbolic mathematics. It is based on Portable Standard Lisp, a machine independent version of Standard Lisp created in the mid-1960's. Cambridge Lisp is available for many other computers, including the Commodore Amiga.

This long and broad development history ensures that the major design decisions involved with Cambridge Lisp were neither based on whim nor taken in haste. However, it also ensures considerable variance from the predominant Common Lisp standard, adopted, in one form or another, by most Lisp vendors in the United States.

FIRST IMPRESSIONS

My first project with Cambridge Lisp was to port a computer vision program, written in Franz Lisp, from a VAX to the ST. Since the Franz dialect is relatively similar to Common Lisp, upon which XLisp is based, I originally tried XLisp as the target language. Unfortunately, XLisp lacked the necessary trigonometric support functions (and I did not feel like adding them to a customized version of the interpreter), so I switched to Cambridge Lisp, relying on its excellent mathematical capabilities to make up for the differences between the dialects.

I was pleased to discover that Appendix 3 of the manual was entitled "Converting to Cambridge Lisp," but was disappointed to find little usable information there. There were no instructions on converting from particular dialects of Lisp, only hints on functions which have unusual names or are unavailable in Cambridge Lisp. For example, the manual mentions the omission of the LET and DO macros, but offers no solution to the problem.

Suffice it to say that the project is still unfinished as of this writing. To make the translation, I had to re-implement several Lisp functions which seemed to me essential but are nevertheless missing from Cambridge Lisp. From trying to port a couple of other Franz Lisp and XLisp programs to Cambridge Lisp, I've concluded that the Cambridge Lisp dialect is not the easiest one to move to for a programmer with experience in Common Lisp and/or its variants


Cambridge
Lisp is a comprehensive
Lisp package, including
an interpreter and
a compiler, an editor,
and a 350-page manual.


However, programmers with little or no Lisp experience will not have such problems; instead, they will face the normally steep learning curve associated with the transition from procedural languages like C and Pascal to an applicative one like Lisp.

DOCUMENTATION

While the Cambridge Lisp manual does little to speed this learning process for new users, providing no tutorial introduction and few examples, it does an adequate job as a reference document for experienced users. Since the manual is such an important part of a language product, we will discuss it before we discuss the software itself. I would advise all Cambridge Lisp users to read the manual before getting down to any serious work.

The first part describes the "generic" items in the Cambridge Lisp programming environment, including the MENU+ shell, ED screen editor, and various file-management tools. In the second part, twenty-two short chapters introduce and discuss the important Lisp-specific portions of the environment, including the interpreter, compiler, and debugging features. Part three briefly explains each primitive Lisp function and object in the customary stylized format.

Part four's documentation of the large library of GEM interface functions is similar so don't expect to find enough information on AES and VDI here alone: count on consulting a reference work like the Programmer's Guide to GEM (Sybex, 1986). Actually, it is unfair to fault a third-party language reference manual for failing to document functions built into the ST itself. Metacomco is to be commended for documenting its own libraries as thoroughly as it has and, especially, for taking the time to compile a 19-page index of the manual. Overall, the Cambridge Lisp manual is a good one; with the addition of a glossary of unfamiliar terms (such as "open coded"), it could be one of the best around.

INTERPRETER

The Cambridge Lisp interpreter provides the work environment (or "total computing world," as the manual describes it) from within which you will do all your program development. It is dynamically scoped, and offers virtually all the basic Lisp primitives for arithmetic, logical operations, input/output, control, function definition and application, and of course list manipulation (also including set lists, association lists, and property lists).

Additionally, several groups of "advanced" features are supported; these include macros, reader macros, and syntax tables, big numbers and extensive mathematical functions, vectors (as true Lisp values), prettyprinting, I/O with "selectable streams," and time functions. One can also customize the top-level Supervisor environment and preserve the state of the system in a binary file for later restoration.

The error-handler and debugger are fairly complete and helpful. Error messages are clear, and the tracing facility invoked with the TRACE and UNTRACE functions provides reams of information on each function call. As for the garbage collector: it works-what more is there to say? For those interested in its inner operations, the manual references a paper describing the underlying algorithms.

A few esoteric features are offerred, such as an AVL-tree package. (AVL trees are balanced trees normally used for efficient searching operations.) However, the string handling package is quite weak, and the DO and LET macros are not included. In general though, all the important features plus many enhancements are present-you just might have to read the manual carefully to find them all.

COMPILER

The Cambridge Lisp compiler is built into the interpreter environment and is normally accessed through the COMPILE function, which simply translates one or more functions directly into 68000 machine code. The compiler can be directed to keep its output in memory or to save it to a binary disk file as a load-on-call module. The compiler treats all variables as lexically scoped unless they are explicitly declared to be either FLUID or GLOBAL.

The compiler sports a good collection of switches and options, including the ability to reduce error-checking to improve efficiency, to embed profiling code in its output, and to save the original function definitions after their conversion to machine code. By setting an interpreter flag, you can cause all new function definitions to be automatically compiled.

COMPLAINTS

A version of the ED screen editor provided in the package is also built into the Lisp interpreter itself. While this thoughtful inclusion does aid interactive program development, it uses up about 30K of memory (and disk space) which could he available for list structure and source code files. Also, there is no function which calls the editor and automatically loads the edited file into Lisp. Finally, although it is a reasonable editor, I am no fan of ED, since I use a version of MicroEmacs for all my program editing. Perhaps in the next release Metacomco will allow the use of any screen editor so users will not have to learn ED only to call it occasionally from within the interpreter.

I had trouble installing the system on my hard disk and had to call Metacomco more than once for technical support. Although the representatives with whom I spoke were courteous, friendly, and responsive, they did not call back as promised. To be fair, Metacomco recommends that users write with questions, so they probably put more effort into answering such requests.

Of course, in any first release of software this complex, there are the expected minor bugs and/or errors in documentation that must be dealt with. The problems with Cambridge Lisp seemed to be related to the fact that it was ported from a generic product to the ST environment. For example, the file named LISPRC is not automatically loaded when the interpreter is started up (the manual says it should be), and the image file directory does not default to IMAGE as the manual says it should.

Although its interpreter and editor run as text-only TOS applications, Cambridge Lisp provides excellent GEM support, with libraries for all the VDI and AES functions available on a load-on-call basis. Special functions are used to access GEM's variables, providing for a complete Lisp-style interface to this portion of the operating system. Unfortunately, there is nothing comparable for the Line-A, BIOS, XBIOS, or GEMDOS calls. Line-A is ignored completely, while the others are accessible by function number and arguments. This is workable, but less than ideal.

I like the Cambridge Lisp compiler, but was disappointed to find that it cannot be used to create stand-alone applications launchable from the Desktop or a command-line interface. If you need such a facility in order to distribute your programs to users who don't own Cambridge Lisp, you must contact Metacomco and discuss "details of licensing arrangements," whatever they may be. (This gem of knowledge is hidden on the obverse side of the manual's title page.) In addition, there is no documented, direct method to incorporate code written in other languages with your Lisp programs.

CONCLUSION

Cambridge Lisp is truly a high-quality, professional programming environment for Al and other Lisp applications. It is similar to Franz Lisp, a popular dialect used worldwide for both research and development, and is suitable for educational purposes as well. Although the Cambridge dialect is unusual, especially in the United States, and slightly behind the times (for example, no object-oriented programming support), it is certainly workable for most applications. I recommend 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.)