User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cl:special_operators:quote [2017/05/01 21:00] (current)
Line 1: Line 1:
 +====== Special Operator QUOTE ======
 +
 +====Syntax====
 +  * quote //object// → //object//
 +
 +====Arguments and Values====
 +  * //object// - an //​[[CL:​Glossary:​object]]//;​ not evaluated.
 +
 +====Description====
 +The //​[[CL:​Glossary:​special operator]]//​ **quote** just returns //object//.
 +
 +The consequences are undefined if //​[[CL:​Glossary:​literal objects]]// (including //​[[CL:​Glossary:​quoted objects]]//​) are destructively modified.
 +
 +====Examples====
 +<​blockquote>​
 +([[CL:​Macros:​defparameter]] *a* 1) <​r>​*A*</​r>​
 +(quote ([[CL:​Macros:​defparameter]] a 3)) <​r>​(DEFPARAMETER A 3)</​r>​
 +*a* <​r>​1</​r>​
 +'*a* <​r>​A</​r>​
 +''​*a* <​r>​(QUOTE *A*)</​r>​
 +'''​*a* <​r>​(QUOTE (QUOTE *A*))</​r>​
 +
 +([[CL:​Macros:​defparameter]] a 43) <​r>​43</​r>​
 +([[CL:​Functions:​list]] a ([[CL:​Functions:​cons]] a 3)) <​r>​(43 (43 . 3))</​r>​
 +([[CL:​Functions:​list]] (quote a) (quote ([[CL:​Functions:​cons]] a 3))) <r>(A ([[CL:​Functions:​cons|CONS]] A 3))</​r>​
 +
 +1 <​r>​1</​r>​
 +'1 <​r>​1</​r>​
 +
 +"​foo"​ <​r>"​foo"</​r>​
 +'"​foo"​ <​r>"​foo"</​r>​
 +
 +([[CL:​Functions:​car]] '(a b)) <​r>​A</​r>​
 +'​([[CL:​Functions:​car]] '(a b)) <​r>​([[CL:​Functions:​car|CAR]] (QUOTE (A B)))</​r>​
 +#​([[CL:​Functions:​car]] '(a b)) <​r>#​([[CL:​Functions:​car|CAR]] (QUOTE (A B)))</​r>​
 +'#​([[CL:​Functions:​car]] '(a b)) <​r>#​([[CL:​Functions:​car|CAR]] (QUOTE (A B)))</​r>​
 +</​blockquote>​
 +
 +====Affected By====
 +None.
 +
 +====Exceptional Situations====
 +None.
 +
 +====See Also====
 +{\secref\Evaluation},​ {\secref\QuoteMacro},​
 +
 +{\secref\ConstantModification}
 +
 +====Notes====
 +The textual notation '''//​object//''​ is equivalent to ''​(quote //​object//​)'';​ see section {\secref\ConstantModification}.
 +
 +Some //​[[CL:​Glossary:​object|objects]]//,​ called //​[[CL:​Glossary:​self-evaluating objects]]//,​ do not require quotation by **[[CL:​Special Operators:​quote]]**. However, //​[[CL:​Glossary:​symbols]]//​ and //​[[CL:​Glossary:​lists]]//​ are used to represent parts of programs, and so would not be useable as constant data in a program without **[[CL:​Special Operators:​quote]]**. Since **[[CL:​Special Operators:​quote]]** suppresses the //​[[CL:​Glossary:​evaluation]]//​ of these //​[[CL:​Glossary:​object|objects]]//,​ they become data rather than program.
 +
 +\issue{CONSTANT-MODIFICATION:​DISALLOW}