* convert strings to symbol
@ 2008-06-16 13:03 alruccaba
2008-06-16 13:17 ` Nicholas Sandow
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: alruccaba @ 2008-06-16 13:03 UTC (permalink / raw)
To: help-gnu-emacs
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.
Unbegrenzter Speicher, Top-Spamschutz, 120 SMS und eigene E-MailDomain inkl.
http://office.freenet.de/dienste/emailoffice/produktuebersicht/power/mail/index.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: convert strings to symbol
2008-06-16 13:03 convert strings to symbol alruccaba
@ 2008-06-16 13:17 ` Nicholas Sandow
2008-06-16 13:27 ` David Hansen
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Nicholas Sandow @ 2008-06-16 13:17 UTC (permalink / raw)
To: alruccaba; +Cc: help-gnu-emacs
On 16/06/2008, at 11:03 PM, alruccaba@justmail.de wrote:
> 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.
Have you looked at (intern "foo") or (make-symbol "foo") ? Do they
do what you want?
>
>
>
> Unbegrenzter Speicher, Top-Spamschutz, 120 SMS und eigene E-
> MailDomain inkl.
> http://office.freenet.de/dienste/emailoffice/produktuebersicht/
> power/mail/index.html
>
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: convert strings to symbol
2008-06-16 13:03 convert strings to symbol alruccaba
2008-06-16 13:17 ` Nicholas Sandow
@ 2008-06-16 13:27 ` David Hansen
2008-06-16 14:16 ` Andreas Röhler
[not found] ` <mailman.13394.1213625735.18990.help-gnu-emacs@gnu.org>
3 siblings, 0 replies; 8+ messages in thread
From: David Hansen @ 2008-06-16 13:27 UTC (permalink / raw)
To: help-gnu-emacs
On Mon, 16 Jun 2008 15:03:57 +0200 alruccaba@justmail.de wrote:
> Does someone have an idea how to convert a string object to a symbol?
`intern' or `intern-soft'.
David
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: convert strings to symbol
2008-06-16 13:03 convert strings to symbol alruccaba
2008-06-16 13:17 ` Nicholas Sandow
2008-06-16 13:27 ` David Hansen
@ 2008-06-16 14:16 ` Andreas Röhler
[not found] ` <mailman.13394.1213625735.18990.help-gnu-emacs@gnu.org>
3 siblings, 0 replies; 8+ messages in thread
From: Andreas Röhler @ 2008-06-16 14:16 UTC (permalink / raw)
To: help-gnu-emacs
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.
>
>
>
> Unbegrenzter Speicher, Top-Spamschutz, 120 SMS und eigene E-MailDomain inkl.
>
http://office.freenet.de/dienste/emailoffice/produktuebersicht/power/mail/index.html
>
>
>
>
make-symbol (?)
(setq a (make-symbol "eins"))
a => eins
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: convert strings to symbol
[not found] ` <mailman.13394.1213625735.18990.help-gnu-emacs@gnu.org>
@ 2008-06-16 14:48 ` David Kastrup
2008-06-16 16:48 ` Andreas Röhler
[not found] ` <mailman.13405.1213634862.18990.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 8+ messages in thread
From: David Kastrup @ 2008-06-16 14:48 UTC (permalink / raw)
To: help-gnu-emacs
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
(print (symbol-value (intern x)))
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: convert strings to symbol
2008-06-16 14:48 ` David Kastrup
@ 2008-06-16 16:48 ` Andreas Röhler
[not found] ` <mailman.13405.1213634862.18990.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 8+ messages in thread
From: Andreas Röhler @ 2008-06-16 16:48 UTC (permalink / raw)
To: help-gnu-emacs
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
>
> (print (symbol-value (intern x)))
>
> --
> David Kastrup, Kriemhildstr. 15, 44793 Bochum
>
Don't work for me.
Even not with
(print (symbol-value (intern "x")))
So it works:
(setq a (intern "x"))
(print (symbol-value 'a))
Probably you can explain the reasons.
Andreas Röhler
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: convert strings to symbol
[not found] ` <mailman.13405.1213634862.18990.help-gnu-emacs@gnu.org>
@ 2008-06-16 17:12 ` David Kastrup
2008-06-20 14:25 ` Andreas Röhler
0 siblings, 1 reply; 8+ messages in thread
From: David Kastrup @ 2008-06-16 17:12 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: convert strings to symbol
2008-06-16 17:12 ` David Kastrup
@ 2008-06-20 14:25 ` Andreas Röhler
0 siblings, 0 replies; 8+ messages in thread
From: Andreas Röhler @ 2008-06-20 14:25 UTC (permalink / raw)
To: help-gnu-emacs
Am Montag, 16. Juni 2008 schrieb David Kastrup:
> 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.
Seems so.
Thanks
Andreas Röhler
> 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
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-06-20 14:25 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-16 13:03 convert strings to symbol alruccaba
2008-06-16 13:17 ` Nicholas Sandow
2008-06-16 13:27 ` David Hansen
2008-06-16 14:16 ` Andreas Röhler
[not found] ` <mailman.13394.1213625735.18990.help-gnu-emacs@gnu.org>
2008-06-16 14:48 ` David Kastrup
2008-06-16 16:48 ` Andreas Röhler
[not found] ` <mailman.13405.1213634862.18990.help-gnu-emacs@gnu.org>
2008-06-16 17:12 ` David Kastrup
2008-06-20 14:25 ` Andreas Röhler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).