Suppose I'm setting a var like this:
(setq var '((:item1 "stringA") (:item2 "stringB")))
(this works)
Now I would like "stringA" be a conditional, like this:
(setq var '((:item1 (if (> 6 (string-to-number (format-time-string "%u")))
"stringA"
"stringC"))
(:item2 "stringB") ))
This doesn't work, likely due to the quote operator (or function?). How should it be written to work?
setqunless you need to port code to dialects that need it.setfworks on everythingsetqis a form of setf whose argument must be a symbol. BUT! if the argument is a symbol macro, it will still work. You can't do(setq (car x) 42)but ifcis a symbol macro which expands to(car x), you can do(setq c 42); it will store to(car x)!setq: just historical baggage from 1960 LISP in which a variable was set using(set 'var value)and sosetqwas invented to add the quote for you: so you could just(setq var value).