(setq a 2)
(setq l '(a b c))
(car l)

Got a when evaluating this, and why its value not 2 ?

  • I didn't think this was completely a duplicate at first. But since OP wants to evaluate a variable that's in the list being quoted, it is. – Drew Oct 31 '19 at 20:57

The single quote inhibits evaluation of elements in the list. An alternative form would be to use the function list instead of single quote, or use a backtick and comma combination. See:


  (setq a 2)
  (setq l `(,a b c))
  (car l))


(let (a b c l)
  (setq a 2)
  (setq l (list a b c))
  (car l))
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.