Classic LISP truth values: In Lisp, which atom conventionally represents the logical value “true” in conditionals and predicates?

Difficulty: Easy

Correct Answer: t

Explanation:

Introduction / Context: Lisp uses simple, elegant semantics for truth: any value other than NIL is considered true. Nevertheless, the community converged on a canonical symbol to represent truth explicitly. Knowing this symbol helps when reading code, documentation, and test predicates.

Given Data / Assumptions:

  • We are using classic Common Lisp conventions.
  • NIL represents false and the empty list.
  • We want the conventional atom used for explicit truth.

Concept / Approach: While Lisp treats any non-NIL value as truthy, the symbol T is the conventional explicit true value. Many built-in predicates return T for success and NIL for failure. This convention improves readability and consistency, even though other non-NIL values would also be treated as true in conditionals.

Step-by-Step Solution: Recall the pairing: NIL = false, T = true.Map options: “t” is the conventional true symbol; others are arbitrary.Select “t.”

Verification / Alternative check: Evaluate (if t 'yes 'no) → YES, (if nil 'yes 'no) → NO. Predicate examples like (numberp 42) typically return T.

Why Other Options Are Wrong: ml, y, time: plain symbols with no special truth status.

None of the above: incorrect; T is standard.

Common Pitfalls: Thinking true must always be T; any non-NIL is treated as true, but T is the conventional explicit true value.

Final Answer: t

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion