[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: convert strings to symbol
From: |
David Kastrup |
Subject: |
Re: convert strings to symbol |
Date: |
Mon, 16 Jun 2008 19:12:19 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
Andreas Röhler <andreas.roehler@online.de> writes:
> Am Montag, 16. Juni 2008 schrieb David Kastrup:
>> Andreas Röhler <andreas.roehler@online.de> writes:
>>
>> > Am Montag, 16. Juni 2008 schrieb alruccaba@justmail.de:
>> >> Does someone have an idea how to convert a string object to a symbol?
>> >> One purpose would be some kind of variable substitution :
>> >>
>> >> (setq y "z")
>> >> (setq x "y")
>> >> (print ..? x ....) -> "z"
>> >>
>> >> Thanks in advance.
>> >
>> > make-symbol (?)
>> >
>> > (setq a (make-symbol "eins"))
>> > a => eins
>>
>> No, that is entirely useless since it creates a new symbol that has only
>> the print name "eins" but is not accessible via its name.
>>
>> He wants something like
>>
>>
>
> Don't work for me.
Works perfectly for me.
(setq y "z")
(setq x "y")
(print (symbol-value (intern x))) -> "z"
> Even not with
>
> (print (symbol-value (intern "x")))
That yields "y". Obviously.
> So it works:
>
> (setq a (intern "x"))
>
> (print (symbol-value 'a))
>
> Probably you can explain the reasons.
Looks like you should reread what you were replying to. What I posted
works _exactly_ like the poster wanted it to work. You are doing
something completely different. Which also works in that it does
something. Just not what was required.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum