common-lisp Quote Quote and self-evaluating objects


Example

Note that many datatypes don't need to be quoted, since they evaluate to themselves. QUOTE is especially useful for symbols and lists, to prevent evaluation as Lisp forms.

Example for other datatypes not needed to be quoted to prevent evaluation: strings, numbers, characters, CLOS objects, ...

Here an example for strings. The evaluation results are strings, whether they are quoted in the source or not.

> (let ((some-string-1 "this is a string")
        (some-string-2 '"this is a string with a quote in the source")
        (some-string-3 (quote "this is another string with a quote in the source")))
    (list some-string-1 some-string-2 some-string-3))

("this is a string"
 "this is a string with a quote in the source"
 "this is another string with a quote in the source")

Quoting for the objects thus is optional.