3 ms·
Blame Warren Teitelman of Xerox PARC. Conversational Lisp, 1973, in Interlisp (FOR OLD X<-M TO N DO (PRINT X) WHILE (PRIMEP X)) Common Lisp (LOOP FOR X
by lispm 9y ago
Blame Warren Teitelman of Xerox PARC.
Conversational Lisp, 1973, in Interlisp
(FOR OLD X<-M TO N DO (PRINT X) WHILE (PRIMEP X))
Common Lisp
(LOOP FOR X FROM M TO N DO (PRINT X) WHILE (PRIMEP X))
Warren's greater idea was to have a very forgiving syntax for Lisp, with spell checker and DWIM (do what I mean) support. Write expressions in different order, with spelling errors, etc. Lisp will figure out what you mean.
The function UNION in CLISP (see https://www.dreamsongs.com/Files/Hopl2.pdf https://www.dreamsongs.com/Files/Hopl2.pdf ):
DEFINEQ((UNION (LAMBDA (X Y)
(IF ~X THEN Y
ELSEIF X:1 MEMBER Y THEN UNION X::1 Y
ELSE <X:1 !(UNION X::1 Y)>]
In MLISP:
EXPR UNION (X,Y)
IF ¬X THEN Y ELSE
IF X[1] ε Y THEN UNION(X↓1,Y)
ELSE X[1] CONS UNION(X↓1,Y);
In CGOL (Algol syntax on top of Lisp)
define x "UNION" y, 14, 13;
if not x then y
else if member(car x, y) then cdr x union y
else car x . cdr x union y <>
or CGOL with extended character sets:
define x "∪" y, 14, 13;
if ¬x then y else if αx ε y then βx ∪ y else αx . βx ∪ y <>
'Conversational' syntax elements were for example often used in some AI systems as user interfaces into knowledge based systems. Rules were often written in similar expressions, example from KEE:
(IF (THE SWITCH OF LIGHT IS ON)
(THE LOOK OF LAMP IS NO.LIGHT)
THEN (DELETE (THE STATUS OF LAMP IS WORKING))
(THE STATUS OF ROOM IS DARK))
Though I'd think the main purpose of LOOP is to have an example that Lisp can incorporate a wider range of embedded syntax variants and to make the language purists run away...