[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Terminology question
From: |
Jean-Christophe Helary |
Subject: |
Re: Terminology question |
Date: |
Wed, 27 Apr 2016 13:05:12 +0900 |
Thank you John for the reply.
Let me ask a few more questions. Apologies if I sound picky, I just want to
make sure I understand.
> 2016/04/26 23:48、John Wiegley <address@hidden> のメール:
>
>>>>>> Jean-Christophe Helary <address@hidden> writes:
>
>> I cannot find a clear definition of "form", "expression", "symbolic
>> expression", "sexp" and whether the terms are equivalent or not.
>
> A "form" is a piece of data in Lisp that represents a program, meaning it can
> be evaluated without error.
>
> 3 is a simple, self-evaluating form
> (3) is not a form
> (+ 1 2) is a form
Ok, that corresponds to 1.3.3:
"A Lisp expression that you can evaluate is called a form. Evaluating a form
always produces a result, which is a Lisp object."
> All of these are Lisp expressions, meaning sentences that are legal according
> to the grammar of the Lisp language.
But in 2.1 we find this:
"In Lisp, an expression is primarily a Lisp object and only secondarily the
text that is the object’s read syntax."
Which seems to suggest that there is no distinction between "form" and
"expression" and thus contradicts 1.3.3.
And that is confirmed by 9.1:
"A Lisp object that is intended for evaluation is called a form or
expression[4]."
But then we seem to have a circular definition...
As a conclusion, according to 1.3.3 if evaluating rose produces an error
message because no value has been assigned to it, it is not a form, but
according to 9.1, if I intend to evaluate rose, which is syntactically valid
Lisp, it is a form...
So I am still confused. Maybe it is because I do not understand what "evaluate"
means in the context of Lisp. In the Introduction 1.2, there is:
"If you run it (for which the Lisp jargon is evaluate), the computer will do
one of three things: do nothing except return to you the list itself; send you
an error message; or, treat the first symbol in the list as a command to do
something."
Again, in Introduction 1.3 there is:
"What we will do is evaluate a list that is not quoted and does not have a
meaningful command as its first element."
So evaluation can produce an error in which case 9.1 is the correct definition
of form and expression: a form is syntactically valid lisp regardless of
whether it produces a Lisp object or not (unless we consider that errors can be
considered Lisp objects, but that does not seem to be the case).
The obvious conclusion is that there is a confusion in the use of the term
"evaluate". In 1.3.3 it means "produce a lisp object", in 9.1 and in the
Introduction it means "see if it produces a lisp object". That meaning seems to
be the one chosen in the Emacs manual (for ex in 27.7 Executing Lisp
Expressions).
I am still confused...
Jean-Christophe Helary