> Thanks to everyone who responded.
> I should have realized that defvar doesn't evaluate it's argument. But
> I'm glad I asked anyway, learned something. I didn't know about the #.
> reader macro, or progv.
> I was trying to do something like the following (why I was doing it is
> too complex to explain :-) :
> Create a function/macro which takes a symbol and an expression, creates
> a variable by prefixing the symbol with NFA and assigns the value of the
> expression to it. So for example:
> (setnfa 'test 10)
> should create a variable NFA-TEST and assign 10 as its value.
> Based on the replies I got, I'm now doing this:
> (defun setnfa (sym val)
> (setf (symbol-value (intern (concatenate 'string "NFA-" (symbol-name
> Not pretty, but it seems to work. Is this a reasonable/reliable way to
> accomplish it?
> Thanks again,
I'd do something like this:
? (defun setnfa (name value)
(let ((symbol (intern (concatenate 'string "NFA-" (symbol-name
(proclaim `(special ,symbol))
(set symbol value)))
? (setnfa 'test 10)
? (describe 'nfa-test)
INTERNAL in package: #<Package "COMMON-LISP-USER">
Print name: "NFA-TEST"