[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
What are special forms?
I have been worrying about what are meant by "special forms".
CLtL defines, in Page 56, that
If the first element (of a list form) is one of the
symbols appearing in Table 5-1, then the list is called
a /special form/.
According to this definition, (SETQ X 1) is a special form but
the symbol SETQ is not. Indeed, the caption of Table 5-1 (page 57)
explicitly says that the table lists *Names* of Common Lisp
special forms. Thus, SETQ certainly is a symbol that names special
forms such as (SETQ X 1) and (SETQ).
So far, so good.
Right below Table 5-1, CLtL says
The set of special forms is fixed ....
This is still OK. The set of special forms consists of infinite
number as its elements, but anyway it is fixed. However, in the next
paragraph, it says
The set of special forms is kept very small ...
Small (!!!) an infinite set is ??? The sentense should rather be
The set of special form names is kept very small ...
The name SPECIAL-FORM-P enlarges such a kind of confusion between
special forms and special form names. The name of the function should
rather be SPECIAL-FORM-NAME-P or something like that. I am writing
this message because I really got confused to read the following message.
Date: Mon, 16 Jun 1986 22:52 EDT
From: "Scott E. Fahlman"
There's no such thing as a FEXPR in Common Lisp, though some
implementations may use such a thing internally in implementing specia
forms. I'll assume that you mean "special form" or "special operator"
or whatever we are calling it. I think that Compiled-Function-P and
Function-P should answer NIL for special forms.
Does this mean, for example,
(COMPILED-FUNCTION-P '(SETQ X 1)) => NIL
(FUNCTION-P '(SETQ X 1)) => NIL
(COMPILED-FUNCTION-P (SPECIAL-FORM-P 'SETQ)) => NIL
(FUNCTION-P (SPECIAL-FORM-P 'SETQ)) => NIL
The latter interpretation seems to contradict CLtL, which says
A returned non-NIL value (of SPECIAL-FORM-P) is typically a function
Incidentally, I would like to ask you what "globally" means in
the following sentence in the CLtL description of SPECIAL-FORM-P in Page 91.
If the symbol globally names a special form, ....
I am sorry if there still is a sort of consensus in US Lisp people in this
issue. But please keep it in mind that CLtL and common-lisp@su-ai are
the only references to me.