Difficulty: Easy
Correct Answer: car
Explanation:
Introduction / Context:
LISP is a classic AI programming language built around symbolic expressions (s-expressions) and list processing. Two primitive selectors, historically named car and cdr, retrieve parts of a list. Recognizing what each returns is essential for reading and writing idiomatic LISP code and for understanding many AI examples from classic literature.
Given Data / Assumptions:
Concept / Approach:
In most LISP dialects, car(list) yields the head element. cdr(list) produces the tail (a list of remaining elements). While some dialects support first as a more readable alias, the primitive historically and portably recognized is car—originating from the hardware architecture of early Lisp machines ('contents of the address register').
Step-by-Step Solution:
Verification / Alternative check:
Running a simple example in any LISP REPL—e.g., (car '(a b c)) → a—confirms the behavior unambiguously.
Why Other Options Are Wrong:
set: Assignment or symbol binding in some dialects; not list selection.
first: Often a synonym, but traditionally the primitive asked in such questions is car.
second: Returns the second element or is defined via (car (cdr ...)).
None: Incorrect because car is standard.
Common Pitfalls:
Confusing dialect conveniences with core primitives; mixing up car and cdr semantics.
Final Answer:
car
Discussion & Comments