Skip to content

the-best-lisp/history-of-lisp-parens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 

Repository files navigation

History of Lisp Editing

I'd like to find out how people tolerated parens back in the golden days of Lisp. I have a feeling we might've forgotten some things that would be useful today, or might influence some new ideas.

I started by working backwards from today (still filling in blanks):

  • 2015 - Parinfer
  • 2014 - Lispy
  • 2012 - Smartparens
  • 2005 - Paredit by Taylor Campbell
  • 2001 - DrScheme, now DrRacket
  • ...
  • 1987 - Interlisp SEdit (structure editor. full interactive display)
  • 198? - Interlisp DEdit (display editor. clickable display + command window)
  • 1980 - Zmacs - first structure commands for text editor
  • ...
  • 1970 - BBN (InterLisp) - ("on-line" structure editor. REPL-based editor)
  • 1966 - PILOT - first thesis on structure editing

Interlisp

In Interlisp, the programmer worked with source code presented by a structure editor, which operated on source code in the form of memory-resident Lisp data structures.
Evolution of Lisp

Teletype Editor

Try it here!

A command-line interface for editing s-expressions. Rather than displaying the whole file, only one expression is displayed at a time—by printing after each command.

  • use N to go Nth child of current expression
  • use 0 to go up to parent
  • nested sub-expressions collapsed by default to &
  • expand with ?
  • pretty-print with pp

Six paren commands can be performed on the current expression's children:

Command Name Mnemonic Extra Inference
BI Both In ()+
BO Both Out ()-
LI Left In (+ adds ) at end
LO Left Out (- removes ) and EVERYTHING AFTER IT
RI Right In )<
RO Right Out )>
(A B C D E F G H) >(BI 3) (A B (C) D E F G H) ^ ^ wrap parens around index 3 
(A B C D E F G H) >(BI 3 5) (A B (C D E) F G H) ^ ^ wrap parens from index 3 to index 5 >(BO 3) (A B _C D E_ F G H) ^ ^ unwrap parens around index 3 
(A B C D E F G H) >(LI 3) (A B (C D E F G H)) ^ ^ insert left-paren before index 3, and right-paren at end 
(A B (C D E) F G H) >(LO 3) (A B _C D E_ _ _ _) ^ ^ ^ ^ ^ remove parens around index 3, and EVERYTHING AFTER IT 
(A B (C D E F G H)) >(RI 3 2) (A B (C D) E F G H_) ^ <----- ^ move right-paren of index 3 to inner index 2 >(RO 3) (A B (C D_ E F G H)) ^ -----> ^ move right-paren of index 3 to end 

See the 1983 Interlisp Reference Manual, Chapter 17. "Commands That Move Parentheses" on page 465.

DEdit

The display editor was a visual alternative to the teletype editor—click one or two expressions in the pretty-print, then click a command to execute on those expressions.

  1. pretty-print window (left) - click to select expressions (current=solid-lined, previous=dash-lined)
  2. command menu (right) - click to perform an operation on selections (current=arg1, previous=arg2)
  3. type-in window (below) - manually type an expression. when done, it becomes selected and clickable

dedit-screen

Clicking an expression while holding Shift unreads it into the type-in window (pastes as text).

  • left click - select object
  • middle click - select containing list
  • right click - select lowest common ancestor with previous selection
DEdit Paren Command Initially Hidden? Teletype Command
() same as BI
( in middle-click () to show same as LI
) in middle-click () to show same as RI
() out same as BO
( out middle-click () out to show same as LO
) out middle-click () out to show same as RO

See the 1985 Interlisp-D Reference Manual Volume II: Environment, Chapter 16 page 407.

SEdit

Try it here!

from the 1987 Xerox Lisp Medley Release Notes:

SEdit is the new Xerox Lisp structure editor. It allows you to edit Xerox Lisp code directly in memory. This editor replaces DEdit in Chapter 16, Structure Editor, of the Interlisp-D Reference Manual. First introduced in Lyric, the SEdit structure editor has been greatly enhanced in the Medley release.

sedit-screen

Two types of carets (cursors):

  • edit caret (set with left-click)
  • structure caret (set with middle-click)
(LEQ n 1) ; 1. left-click "Q" ─⌃ (LEQ n 1) ; 2. middle-click "Q" ───▲ (LEQ n 1) ; 3. middle-click "Q" again ─────────▲ 
(LEQ n 1) ; 1. left-click "E" ─⌃ ┌──┐ (L│EQ│ n 1) ; 2. right-click "Q" └──┘ 
(LEQ n 1) ; 1. middle-click "E" ───▲ ┌───────┐ (│LEQ n 1│) ; 2. right-click "1" └───────┘ 
  • gaps
  • broken atoms
  • special characters

Notes:

ZMacs

ZMacs in 1980 is reported to be the first text editor with balanced parentheses commands. The 1987 ZMacs Editor Reference shows them on page 209 (3-137):

LISP/VM

I must say that I wish I could use LISP/VM again, and Martin's editor. I've always felt it gave me the best interface, with the highest productivity, of any editor I've ever used for LISP. (source: https://groups.google.com/d/msg/comp.lang.lisp/D2Q5t8IEOkg/EjgB3XBP8hQJ)

In the 1984 LISP/VM User's Guide

...

Maclisp

(preferred formatted ASCII files over data structures for programs)

Debating Maclisp vs Interlisp (i.e. storing code as text vs structure)

A discussion/debate from 1978 that reveals a lot about how people thought about text vs structure when storing and displaying their code:

Programming in an Interactive Environment: the Lisp Experience

This is so far my favorite summary of this topic from 1997. (too many great points to list). https://groups.google.com/d/msg/comp.lang.lisp/dldLx8Yj7q8/u4y2zq19XIYJ

Appendix

Non-Lisp discussions on structure editing

Researching methods

started from Paredit credits, (could not locate sedit.el):

The original inspirations for paredit were Interlisp-D's structure editor 'SEdit' -- a real structure editor, not a cheesy imitation like paredit -- and Guillaume Germain's sedit.el for GNU Emacs.

  • finding mailing list discussions
  • looking for official reference manuals of lisp machines
  • using deepdyve to find articles
  • asking around

General:

About

a history of Lisp's most notorious artifact, parentheses

Resources

Stars

Watchers

Forks

Packages

No packages published