[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sweet-expressions are not homoiconic

This page is part of the web mail archives of SRFI 110 from before July 7th, 2015. The new archives for SRFI 110 contain all messages, not just those from before July 7th, 2015.



David A. Wheeler scripsit:

>   It's worth noting that R7RS-small drops [...] as a requirement, so clearly
>   there's no groundswell of support for [...] as a synonym for (...).

I was actually surprised by how strong the vote was for that.  We had
15 voters back then, and 11 voted against it, with such comments as
"It would be better to make brackets be reader syntax for some data
structure that is distinguishable from lists" (Radul), "You can't take
something as syntactically precious as one of the two remaining unused
balanced-delimiter pairs and *do nothing* with it" (Shivers), "Actually,
I would like [] to be reader syntax for vector data" (Sussman), and even
"Over my dead body! :)" (Shinn).

I myself liked the Interlisp rule, whereby ] would terminate any number of
(s back to the last [, or the top level if there was none:

(define (foo n)
  (let ((k 32))
    (if (= n 0)
      (+ k k)
      (begin
        (display "Double!")
        (+ n n]

But nobody else does, it seems.  Technically, in Interlisp ) would also
terminate any number of [s in the same way, but I never heard of anyone
actually using that.

> > [...] that it is quite implausible to claim that sweet-expressions
> > are homoiconic.  In the general case, reconstructing the underlying
> > data structure from the sweet-expression that represents it requires
> > the mental application of a non-obvious algorithm of considerable
> > intricacy.
> 
> I can do it.  Alan can do it. Other participants here can do it too.
> Therefore, it's homoiconic.

As far as I am concerned, homoiconicity has nothing to do with lexical
syntax at all.  If code is a special case of data, the language is
homoiconic.  Lisp is homoiconic not because of its parentheses, but
because a Lisp program is a Lisp datum.  Python is not because a Python
program is not the external representation of any standard Python data
structure (not counting, of course, the trivial case of the interpreter's
own data structures).

-- 
Babies are born as a result of the              John Cowan
mating between men and women, and most          http://www.ccil.org/~cowan
men and women enjoy mating.                     cowan@xxxxxxxx
    --Isaac Asimov in Earth: Our Crowded Spaceship