Difficulty: Easy
Correct Answer: (defconstant
Explanation:
Introduction / Context:
Common Lisp has several defining forms for variables and constants. When you need to bind a symbol to a value that should not change (i.e., a constant), you use the defconstant form. It takes the symbol name (not evaluated) and an initializing form (evaluated) whose resulting value becomes the constant’s value.
Given Data / Assumptions:
Concept / Approach:
The form (defconstant name value-form) defines name as a global constant. The name is a symbol, not evaluated; the value-form is evaluated at definition time, and the result is stored. Afterward, redefining may be implementation-dependent or produce warnings because constants are meant to be stable. Other forms in the options are either non-existent in Common Lisp or do not match the semantics described.
Step-by-Step Solution:
Verification / Alternative check:
In a Lisp REPL, (defconstant +pi+ 3.14159) defines a constant. The symbol +pi+ is not evaluated as a variable at read time; it is used as a name. The numeric literal is evaluated to itself and stored as the constant value.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing defconstant with defparameter (which allows reassignment) or defvar (which initializes only if unbound). Misunderstanding evaluation: symbol names in defining forms are not evaluated.
Final Answer:
(defconstant <sconst> <object>)
Discussion & Comments