3 ms·
It's a bit misleading though. QUOTE is a special operator, which prevents data from being evaluated. But: special operators are in general not about quoting. Th
by lispm 6y ago
It's a bit misleading though. QUOTE is a special operator, which prevents data from being evaluated. But: special operators are in general not about quoting. They provide various built-in evaluation rules.
Quoting means that a thing is returned as itself and not evaluated. Thus it is not interpreted in any other way.
Take IF, it does not quote its arguments, it just conditionally evaluates them based on the result of the test form. It implements control flow. Thus IF evaluates things - it does not quote them - they are not returned as they were in the source code.
(if
test-form ; evaluated first
then-form ; evaluated when test-form is true
else-form) ; evaluated when test-form is false
Thus each of the above three argument forms might be evaluated, but only one of the last two, depending on the evaluation of the first form. In a compiled Lisp, the then-form and else-form will not be stored as quoted forms in the code, they will be compiled to some other language (often machine language, C, or similar), just as the rest of the source code. Thus after compilation all these source forms will disappear and only executable code will be left. Thus there is nothing to quote by the IF operator.
Special operators usually the core of needed built-in control flow and scoping operators. Typically in Lisp, they are also not user extensible in the standard language: the user can't write new special operators.
Many other additional operators are derived from those via macros, which transform source code to new source code which eventually only contains function calls and special forms.