[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)...
- how to convert a string to a symbol?, sunway, 2008/09/14
- RE: how to convert a string to a symbol?, Drew Adams, 2008/09/14
- RE: how to convert a string to a symbol?,
Drew Adams <=
- Message not available
- Re: how to convert a string to a symbol?, sunway, 2008/09/14
- Re: how to convert a string to a symbol?, Pascal J. Bourguignon, 2008/09/14
- Re: how to convert a string to a symbol?, Tim X, 2008/09/14
- Re: how to convert a string to a symbol?, sunway, 2008/09/14
- Re: how to convert a string to a symbol?, Joost Diepenmaat, 2008/09/14
- Re: how to convert a string to a symbol?, Pascal J. Bourguignon, 2008/09/14
- Message not available
- Message not available