Reputation: 1007
In this code dolist binds x to symbols 'foo and 'bar.
(dolist (x '(foo bar))
(print (symbolp x) t))
This is a problem if I want to use values of foo and bar, like:
(dolist (x '(foo bar))
(print x t))
How to get around it?
Upvotes: 2
Views: 166
Reputation: 370435
x
is bound to the symbols foo
and bar
because '(foo bar)
is a list containing the symbols foo
and bar
. If you want a list that contains the values of the variables foo
and bar
, you can use (list foo bar)
.
Upvotes: 12