TWENEX Interlisp Tutorial
Interlisp-10, for Interactive Lisp, is an implementation of the Lisp programming language developed from 1966 at Bolt, Beranek and Newman (BBN) for TENEX, BBN's in-house PDP-10 operating system, and later DEC's TOPS-20 operating systems. From 1970, development of Interlisp was transferred to Xerox Palo Alto Research Center.
The language became popular with Stanford University AI researchers and at other principally US West-Coast institutions.
Interlisp Features
At the time of its creation, what distinguished Interlisp from most other programming languages and systems was that it attempted to provide the user with a complete set of tools for making it possible for him or her to accomplish the desired task as easily as possible. Listed below are a brief summary of some of the more interesting features, and complete details are found in the Interlisp Reference Manual1).
Editor – Interlisp has a list structure oriented editor for easy modification of functions, property lists and variable values without having to leave Interlisp to use a text editor.
Break package – A package for giving control to he user when an error occurs so variable values can be examined and other tests preformed. It also includes the ability to set breakpoints and trace functions.
File package – A set of functions which are fully integrated into the system to keep track of what files source and compiled versions of functions reside, and automatically maintaining updated versions of these files when changes are made.
Record package – A package for creating record structures which allow one's code to be written independent of the data structures acutally chosen for the implementation.
DWIM – “Do What I Mean” – a spelling corrector which attempts to fix spelling errors and other obvious mistakes.
CLISP – “Conversational LISP” – A package which allows the user to write in an ALGOL-like lisp notation including FOR and WHILE loops, and a simple syntax for record references, functions like CAR and CDR, and infix arithmetic operators.
Helpsys – An on-line help and documentation facility. (Not available on TWENEX.)
Masterscope – A program for analyzing the structure of large programs and answering questions like “What functions call FOO” or “EDIT functions which reference MUMBLE freely”
In and Out
Start Interlisp with the EXEC command @INTERLISP:LISP
. Return to EXEC with the Interlisp command LOGOUT()
or Ctrl-C.
Interlisp Tips
Although the Interlisp programming language is not identical to Lisp 1.5, Clark Weissman's
Lisp 1.5 Primer2) is recommended as an introduction for Interlisp users.
The Interlisp top-level prompt character is a “_”.
The Interlisp top-level allows expressions to be entered over multiple lines. Type a carriage-return to continue input on a new line. To make Interlisp evaluate an input expression, type a right parenthesis to close the last open left parenthesis. (Interlisp will append a carriage-return automatically.)
The Interlisp top-level accepts commands in either of two formats:
EVAL format: (s-expression)
EVALQUOTE format: function(arguments)
Interlisp supports both upper- and lower-case characters, and names are case-sensitive. Names of core functions are defined in uppercase, but the DWIM facility can automatically correct incorrect capitalization.
The Interlisp read program treats square brackets (“]”) as “super-parentheses”: a right square bracket automatically supplies enough right parentheses to match back to the last left square bracket (in the expression being read), or if none has appeared, to match the first left parentheses, e.g., (A (B (C] ⇒ (A (B (C)))
, (A [B (C (D] E) ⇒ (A (B (C (D))) E)
You can insert comments in your Interlisp code with (* comment)
. Comments will be included when functions are saved to a file, and displayed with the function definition by getd. Prettyprint displays all comments as “** COMMENT **”.
Type a single quotation mark (“'”) immediately in front of any expression to quote it: (A 'B C)
⇒ (A (QUOTE B) C)
Type a percent sign (“%”) before a syntactic delimiter character to escape it and include it as part of an atom. Use “%%” to enter a percent sign.
Type “?=” followed by a carriage-return at any point during input to be given the argument names and corresponding values (if any) of the expression (form) being typed.
Interlisp Control Characters
Ctrl-C | Return to EXEC. Interlisp can be resumed with CONTINUE . |
Ctrl-D | Return to Interlisp top-level. |
Ctrl-N | Call Interlisp editor on the expression being read, when the read is completed. |
Ctrl-O | Clear output buffer. |
Ctrl-U | Print “##” and clear the read line buffer, i.e., erase the entire line up to the last carriage-return. |
Ctrl-V | Escape the following control character that would otherwise interrupt the input process. |
Ctrl-W | Erase the last expression typed in the read input buffer, echoing “\\”. (Will back up to previous lines.) |
Backspace | Erase the last character typed in, echoing a “\” and the erased character. |
Example Session
Interlisp Editor
Hello, World!
The example session referenced above defines a recursive factorial function. Below is one way to define a Hello, World! function in Interlisp. After typing the definition, run the function by typing HELLO()
.
(DEFINEQ
(HELLO
[LAMBDA NIL (* edited:
" 6-Oct-2024 23:")
(PRIN1 "Hello, World!") (* Print string without
quotation marks, then
CR-LF on standard
output)
(TERPRI])
)