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

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

Re: convert strings to symbol


From: Andreas Röhler
Subject: Re: convert strings to symbol
Date: Fri, 20 Jun 2008 16:25:47 +0200
User-agent: KMail/1.9.6 (enterprise 20070904.708012)

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
> 






reply via email to

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