MinSeob Lim
MinSeob Lim

Reputation: 101

Lisp - Make a list with variable value

I save the variable value (setf num (+ 4 5)) like this and I save the (setf str '("Hello")).

And then I want make a list like this (setq v '(num str)). However because of the single quote, it doesn't recognize it as a string and not working as expected.

how can i make a list with variable value?

Upvotes: 3

Views: 4863

Answers (1)

sds
sds

Reputation: 60004

The special operator quote prevents evaluation of your variables.

You need to call a function (which evaluates its arguments), e.g., list:

(list num str)
==> (9 "Hello")

Upvotes: 5

Related Questions