If LT
is a top-level variable, defined with defvar
, then you can get its value with symbol-value
as such:
* (symbol-value 'lt)
(A B C)
* (defun sep (name)
(assert (symbolp name))
(let ((value (symbol-value name)))
...
Question
I'm taking a list name as input with a single quote ('), but after doing a few operations, I want to actually evaluate it instead of treat it as an atom.
So for example, just for simplicity sake, I have the following list:
(setf LT '(A B C))
I have a function called SEP
. To run the function, I must run it as (SEP 'LT)
. So as you can see, LISP will interpret LT
as an atom instead of evaluate it as a list, which is not what I want.
So essentially, I want (SEP 'LT)
to really become (SEP '(A B C))
somehow.
The input format can't be changed. Any help would be appreciated. Thanks!
Solution
If LT
is a top-level variable, defined with defvar
, then you can get its value with symbol-value
as such:
* (symbol-value 'lt)
(A B C)
* (defun sep (name)
(assert (symbolp name))
(let ((value (symbol-value name)))
...