help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: how to convert a string to a symbol?


From: Drew Adams
Subject: RE: how to convert a string to a symbol?
Date: Sat, 13 Sep 2008 23:10:58 -0700

> > (setq str "(> 2 1)")
> > I want something like: (eval (string-to-symbol str))
> 
> (intern str)

And if you really want the value of the symbol (per your use of `eval' above):

(symbol-value (intern str))

But you might want to give it a value first ;-) -

(set (intern "(> 2 1)") 42)

(symbol-value '\(>\ 2\ 1\)) ; The answer is 42.

However, as always with questions of this type, one wonders what you are
_really_ trying to do (not to mention why)...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]