Skip to content

Instantly share code, notes, and snippets.

@sogaiu
Last active April 15, 2021 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sogaiu/82c545d43fa77513257095acd4386b34 to your computer and use it in GitHub Desktop.
Save sogaiu/82c545d43fa77513257095acd4386b34 to your computer and use it in GitHub Desktop.
about lisp editors - via "Common Lisp - A Gentle Introduction to Symbolic Computation"
The most frequently occurring errors in LISP are parenthetical errors. It
is thus almost imperative to employ some sort of counting or pairing
device to check parentheses every time that a function is changed.
— Elaine Gord, “Notes on the debugging of LISP programs,” 1964.
The above quote was written 25 years ago, when Lisp programs were typed
on punched cards. Today, of course, we use interactive editors. Lisp editors
are not ordinary text editors: They “understand” the syntax of Lisp programs.
On my machine, whenever I type a right parenthesis, the editor flashes the
corresponding left parenthesis for me. This keeps me from making a
“parenthetical error” when entering Lisp expressions. Another one of my
editor’s jobs is to automatically indent every line as I type it. If a
function definition takes several lines, it will be indented in a neat and
orderly format that is easy to read.
Some of the earliest Lisp books were written before anyone thought of
systematically indenting programs to make them readable. A program that would
have been written this way back then:
(defun long-function (some-list) (cons
(third some-list) (list (second (some-list)
(fourth some-list) (first some-list))))
would today be automatically indented to look like this:
(defun long-function (some-list)
(cons (third some-list)
(list (second some-list)
(fourth some-list)
(first some-list))))
There are two more things a good Lisp editor provides. One is an easy way
to evaluate expressions while editing. You can position the cursor (or mouse)
on a function definition, hit a few keys, and that function definition will be
evaluated without ever leaving the editor. The second thing a good editor
provides is rapid access to online documentation. If I want to see the
documentation for any Lisp function or variable, I can call it up with just a
few keystrokes. The editor also provides online documentation about itself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment