[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to convert a string to a symbol?
From: |
sunway |
Subject: |
Re: how to convert a string to a symbol? |
Date: |
Sun, 14 Sep 2008 00:10:33 -0700 (PDT) |
User-agent: |
G2/1.0 |
I don't want to take "(> 2 1)" as a symbol name, instead I want "(>
2 1)" be evaled to 't'
On Sep 14, 2:10 pm, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > > (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, 2008/09/14
- Message not available
- Re: how to convert a string to a symbol?,
sunway <=
- 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