Re: Terminology question: are s-exps the text or the data or both?

From: Anton van Straaten (anton_at_appsolutions.com)
Date: 10/26/03


Date: Sun, 26 Oct 2003 09:12:22 GMT

Kenny Tilton wrote:
>
>
> Sebastian Stern wrote:
> > The concept of s-expressions is clearly explained in John McCarthy's
> > original paper on Lisp
> >
(http://www-formal.stanford.edu/jmc/recursive/node3.html#SECTION000300000000
> > 00000000), and he uses the words 'character' and 'string', so he must
means
> > the external (textual) representation.
>
> You guys are all kidding right, when you say "text"?:
>
> "We shall now define the S-expressions (S stands for symbolic). They are
> formed by using the special characters:
>
> . ( )
>
> and an infinite set of distinguishable atomic symbols. For atomic
> symbols, we shall use strings of capital Latin letters and digits with
> single imbedded blanks."

Those "special characters" and "strings of capital Latin letters and digits
with single imbedded blanks" are an example of what is usually referred to
as "text".

> What part of "S stands for symbols" is not understood?

"S stands for symbolic" refers to the expressions that are formed by the
provided rules. S-expressions are symbolic expressions which are defined in
terms of a textual representation, i.e. they are formed by a sequence of
characters, including special characters and strings of alphanumeric
characters.

There are other possible representations for S-expressions. One such
alternate representation is the Lisp objects produced by the reader.
However, in that representation, the special characters, . ( ), do not
usually exist explicitly. This is a further indication that the referenced
definition is referring to a textual representation.

Note that the S-expressions formed by the defined notation are not text, and
nor are they Lisp objects. They are a conceptual entity with multiple
possible representations, but in the above link they are defined in terms of
their textual representation.

> And then "For atomic symbols, /we shall use/ strings..." emphasis added.
> So the strings are not the symbols, they are used for them.

Right, the strings are not the symbols, they are the textual representation
of the symbols. That's the point - the definition defines how text is used
to form S-expressions.

> And if one programs in Lisp, I trust one knows that the name of a
> symbol (the string) is the name of the symbol, not the symbol itself.
>
> Tell me, why isn't read-from-string called read-from-symbol?

Because read-from-string, like READ, converts a textual representation of
S-expressions into a Lisp object representation.

> Does symbol-name return a symbol? Not. Look up sumbol in the HyperSpec.
> WEhat do you know! Name is an /attribute/ of a symbol:
>
> "The name of a symbol is a string used to identify the symbol.
> Every symbol has a name, and the consequences are undefined
> if that name is altered. The name is used as part of the external,
> printed representation of the symbol"
>
> I would say a little more rigor was required, but this does not even
> require rigor to get straight.

Then again, perhaps it does... ;)

> When you realized you did not have a good answer, you should have said.
> "Doh!" and changed your answer. The reader reads text and returns
> symbolic-expressions.

The reader reads a textual representation of symbolic expressions and
returns an object representation.

Anton



Relevant Pages

  • Re: Unicode LISP??
    ... I'm not experienced with Common Lisp library, ... terms of strings rather than characters. ... have their representation upgraded if they are updated in place. ...
    (comp.lang.lisp)
  • Re: Homoiconicism
    ... Lisp code is represented in list form, and lists are one of the data ... representation of code is the same in a language implementation. ... Lisp uses this a mechanism to internalize and externalize code. ...
    (comp.lang.lisp)
  • Re: Homoiconicism
    ... Lisp code is represented in list form, and lists are one of the data ... The term homoiconicity refers to the fact that the external and internal representation of code is the same in a language implementation. ... In Lisp, the external representation of code is that of s-expressions. ...
    (comp.lang.lisp)
  • Re: Homoiconicism
    ... Lisp code is represented in list form, and lists are one of the data ... representation of code is the same in a language implementation. ... Lisp uses this a mechanism to internalize and externalize code. ...
    (comp.lang.lisp)
  • Re: Changing Unicode object to Tuple Type
    ... Now I wanted to use pyRXPU to get all ... I don't know pyRXP and pyRXPU, and especially not how you use them. ... No specialized Python classes are used in the representation -- just ... tuples, dicts, lists, and strings. ...
    (comp.lang.python)