tobold.org

correct • elegant • free

△ comp.lang.misc △

Derivation of PL/I ▻

Lisp syntax

In article <3821676B.856CF2D9@is9.nyu.edu>,
Rob Linwood  <rcl211@is9.nyu.edu> wrote:
>Lisp syntax is very regular

I've seen this claim made lots of times, but from the little Lisp
(mostly Scheme) programming I've done, I don't think it's true.

Every special form has its own syntax.  I suspect that the fact that
they all *look* very similar is one of the reasons people find Lisp
confusing.  As a trivial example, consider these two snippets of code.

    (if (> n 10) (< n 20) (> n 5))

    (list (> n 10) (< n 20) (> n 5))

The surface syntax is identical.  Yet one evaluates only two of the
subexpressions, and returns a Boolean; the other evaluates all three
subexpressions, and returns a list.

On a similar note, `((' always throws me.  On the rare occasions it
appears in "normal" code, it indicates that you are calling the function
returned by another function: `((lambda (x) (+ 1 x)) 5)'.  But usually
it appears in special forms like `cond' and `let', where it means
nothing of the sort.

As I've gained more experience with Lisp, these syntactic issues have
become less confusing for me; as they do when learning any language.
But I maintain that Lisp has just as much syntax as the next language,
and the fact that it's less visually obvious doesn't make it any
simpler.

Tim.
--
Tim Goodwin   | "People think [ W. Gibson is ] hi-tech because his prose
Leicester, UK | is as pleasant to read as a C++ program." -- JT

Comment

Since I wrote this piece, I'm pleased to report that I've done a lot more Lisp programming (still mostly Scheme). In the article above, I guess I was mainly thinking about Lisp syntax from the point of view of a human programmer. I still think that Lisp has some syntax, and learning the language involves learning that syntax. (But "just as much syntax as the next language"? Well, no. The next language probably has operator precedence, for example.)

As I see it now, the point that people are trying to make - should be trying to make - about Lisp syntax is that there is a trivial 1:1 mapping between a hunk of Lisp code and its Abstract Syntax Tree representation. This is the feature that makes it possible to write a Scheme interpreter before breakfast, and it is an important and powerful aspect of the language.

Original headers:

From: tjg@star.le.ac.uk (Tim Goodwin)
Newsgroups: comp.lang.misc
Subject: Lisp syntax (was Re: Language recommendation)
Date: 4 Nov 1999 13:56:30 -0000
Organization: University of Leicester, UK
Message-ID: <7vs3b4$gmb$1@ltpcg.star.le.ac.uk>
References: <381f4b3f.1342440@freenews.remarq.com>
  <38201889.B88C35E5@is9.nyu.edu> <3820225e.56422228@freenews.remarq.com>
  <3821676B.856CF2D9@is9.nyu.edu>

△ comp.lang.misc △

Derivation of PL/I ▻