gcl
on the
Engineering machines.
liquid-full
on
the CS Research Suns.
info
documentation facility built into emacs. To
read this, start emacs and then press control-H i
to
enter info
mode. You should then hit the m
key and type GCL Doc
and Return
to read
these pages.
gcl
to the shell.
When it starts up, it reads the file init.lsp
in the
current directory. You can place customizations there. I recommend
that you begin by installing the following init.lsp
file.
The easiest way to run GCL on Unix is inside an emacs
window. I strongly recommend that you learn to use emacs
if you haven't already. To run GCL inside emacs, you need to add a
few lines to your .emacs
file to install the
ILISP
package. You can download them here, and insert them into your .emacs
file.
With these changes installed, you can then restart emacs and type
ESC x gcl RETURN
to create a second window and start up
GCL. You must issue this command from an emacs buffer that is
attached to your home directory (for example, if you run emacs
starting in your home directory, then the *scratch* buffer will work
fine).
Each complete expression that you type in this window will be
sent to GCL when you hit Return
. In addition, emacs will
interact with GCL "invisibly" to implement various nice features, as
described below.
ESC-CONTROL-f
Move forward one s-expression.
ESC-CONTROL-b
Move backward one s-expression.
ESC-CONTROL-a
Move to the start of the current
lisp function.
ESC-CONTROL-SPACE
Mark the s-expression (i.e.,
make the current active region the S-expression that starts at the
cursor. It can then be operated on by commands to delete, kill, or
copy the region.
ESC-CONTROL-t
Transpose s-expressions
(interchanges the current S-expression and the immediately preceding
S-expression).
CONTROL-j
enters a new line
and indents to the proper level for the surrounding S-expression.
Hitting TAB
indents the current line to the proper
level. Comments are handled properly (comments in lisp are introduced
by the semicolon). Hitting ESC-q
re-indents the entire
current function definition that you are working on.
If you have installed the ILISP package, then there are several additional commands available:
CONTROL-z a
will look up the arguments for the
current incomplete function call. For example, if you type "(sort "
followed by CONTROL-z a
, a small emacs window will open
at the top of your screen with the following information:
----------------------------------------------------------------------------- SORT [Function] From ((SORT . Sequences and Arrays and Hash Tables) gcl-si.info): - Function: SORT (SEQUENCE PREDICATE &key (KEY #'IDENTITY)) Package:LISP Destructively sorts SEQUENCE. PREDICATE should return non-NIL if its first argument is to precede its second argument. -----------------------------------------------------------------------------
This is fantastic for quickly looking up a bit of documentation about a function.
CONTROL-z b
switch to the GCL buffer.
CONTROL-z l
load a file into GCL (it will load the
binary file if it is newer). It will ask whether you want to compile
the file if it is not compiled (or if the source is newer than the
binary).
]
close all remaining open parentheses.
CONTROL-H m
(help
mode) to get concise documentation within emacs.
One strategy for single-stepping lisp programs is to step through the
source program and evaluate the expressions one at a time. To
evaluate the next expression after the cursor, type CONTROL-z
n
.
set sm
to
turn on matching parentheses and set ai
for automatic
indentation. Unfortunately, the automatic indentation mode is not
smart enough to indent depending on the degree of nesting of the lisp
expression, but at least it is a start.
However, in this course, you probably won't need to compile your functions, except for some of the highly search-intensive ones later in the quarter. Compiled functions are more brittle (e.g., most error checking is turned off), so it is definitely safer to use uncompiled functions until they are very mature and don't need further debugging.
ld: (Warning) Linker features were used that may not be supported in future releases. The +vallcompatwarnings option can be used to display more details, and the ld(1) man page contains additional information. This warning can be suppressed with the +vnocompatwarnings option.I haven't figured out how to suppress this warning, however.