In Common Lisp, it seems like ()
is a self-evaluating form. That is, it evaluates to itself (or its alias nil
). So there would seem to be no need to quote it. But using grep on my quicklisp directory finds numerous instances of '()
, written by many different people in many different projects. Is there a technical reason for writing out the quoted version? Common Lisp the Lanugage, 2nd Edition, Section 1.2.2, mentions the stylistic differences where you may want to emphasize empty lists with ()
, and boolean false with nil
, but does not cover this question. One of the examples Steele uses is:
(append '() '())
...which I believe could be written just as well as:
(append () ())
...so why throw the extra QUOTEs
in there? Certainly it doesn't hurt things. Stylistically, is one form generally preferred to the other? Someone could certainly make the case that quoted form makes it simpler to add elements to in case you change your mind, and really want a non-empty literal list instead. Or that there is a certain symmetry in using the quote, because a non-empty literal list would also need it.
Is this historical baggage hanging around from other/older related languages that have been carried on by tradition?
This is unlike Scheme, where you do need to quote it. And it seems like you don't have to quote it in elisp, so maybe in a round-about way it could be related to lisp-1 vs. lisp-2?