Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!europa.eng.gtefsd.com!howland.reston.ans.net!EU.net!uknet!festival!edcogsci!jeff
From: jeff@aiai.ed.ac.uk (Jeff Dalton)
Subject: Re: Why do people like C? (Was: Comparison: Beta -
Message-ID: <Cy1Evp.4FH@cogsci.ed.ac.uk>
Sender: usenet@cogsci.ed.ac.uk (C News Software)
Nntp-Posting-Host: bute-alter.aiai.ed.ac.uk
Organization: AIAI, University of Edinburgh, Scotland
References: <37p0uq$2gn@omnifest.uwm.edu> <19941016T124439Z.enag@naggum.no>
Date: Fri, 21 Oct 1994 19:16:37 GMT
Lines: 60

In article <19941016T124439Z.enag@naggum.no> Erik Naggum <erik@naggum.no> writes:

>|   LISP, itself, was never meant to be a purely bracketed language.  That
>|   syntax was designed as a holdover until the language could be complete
>|   -- a first generation in a bootstrapping process.  It's just that the
>|   McCarthy never got around to finishing his project.  Undoubtedly, part
>|   of the reason was that Context Free Grammars were hardly even known
>|   back then.
>
>could you provide some references for this history lesson?  I'd like to
>update my insufficient view on this one.

That "history" contains elements of the truth but is misleading.

And since I just happened to write something on this a while back,
I can repeat it here (below).

BTW, a CFG appears in the Lisp 1.5 book and McCarthy was presumably
familiar with the BNF work for Algol.  So even if we suppose CFGs
weren't available on Day One, they were there in plenty of time for
Lisp 1.5.

Some history:

The list / S-expr notation for Lisp was not originally meant to be
used for programming.  Instead there were M-exprs which looked more
like an ordinary language.  A translation from M-exprs to S-exprs
was defined so that Lisp programs could be represented using a 
data structure that could be manipulated in Lisp.  That made it
possible to write a "universal function" (interpreter) for Lisp
in Lisp.  McCarthy wrote it in the M-notation and, it seems,
thought of it as having chiefly theoretical interest.  Steve Russell
then noticed that it could be "hand compiled" to give an actual
interpreter, and we've been using the S-expr notation ever since.

In fact, the notation was surprisingly popular, and alternative
syntaxes have not been very successful.  Nonetheless, M-exprs are
still around here and there.  McCarthy has used a version of the
notation in lecture notes, John Allen's Anatomy of Lisp uses
M-exprs, and a fairly recent textbook whose name I've forgotten
used M-exprs and even provided a reader for them so that students
could use them to write programs.

Anyway, here's an example:

   mapcar[fn;l] = 
     [null[l] -> ();
         t    -> cons[fn[car[l]]; mapcar[fn; cdr[l]]]]

";"s and "[...]"s are very common.  f[a;b] is a two-arg fn call.

The [p1 -> e1; p2 -> e2; ...; pn -> en] is a conditional expression.
It can be translated directly into COND, which is where COND gets its
somewhat odd syntax.

>|   LISP is, after all, the second oldest language in common use.

Lisp is not really a single language these days.

-- jeff
