Difficulty: Easy
Correct Answer: (setq a 10)
Explanation:
Introduction / Context:
LISP uses prefix notation and provides special forms for variable binding and assignment. A common beginner task is to set a symbol to a numeric value. Selecting the correct form builds confidence with fundamental LISP syntax and semantics.
Given Data / Assumptions:
Concept / Approach:
In Common Lisp, setq assigns a value to a variable (symbol) that already exists or establishes it in the appropriate scope. The canonical assignment to set a to 10 is (setq a 10). setf is a generalized assignment macro, but (setf 10 a) is invalid because the place must be something assignable, not a literal. let creates new bindings in a local scope and requires a list of pairs; (let (a 10)) is not the correct binding syntax, which would be (let ((a 10)) ...). There is no standard assign special form in Common Lisp.
Step-by-Step Solution:
Verification / Alternative check:
Running (setq a 10) in a REPL yields 10 and thereafter evaluating a produces 10, verifying the assignment.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing local binding with assignment; misplacing arguments to setf; forgetting that literals cannot be assignment targets.
Final Answer:
(setq a 10)
Discussion & Comments