[comp.emacs] GNU Emacs string-to-symbol function ?

weiner@novavax.UUCP (Bob Weiner) (04/30/89)

Anyone know if there is a way to convert a string to a symbol-name in
GNU Emacs Lisp?

If some VERY nice soul could mail me a multi-part shar archive of a
recent version of the GNU Emacs Lisp Programmers' Manual (go ahead and
compress it and uuencode it), I would be deeply indebted.  I know its
large, but I understand it may take a while before printed copies are
available.

Thanks.

-- 
Bob Weiner, Motorola, Inc.,   USENET:  ...!gatech!uflorida!novavax!weiner
(407) 738-2087

Ram-Ashwin@cs.yale.edu (Ashwin Ram) (04/30/89)

In article <1256@novavax.UUCP>, weiner@novavax.UUCP (Bob Weiner) writes:
> Anyone know if there is a way to convert a string to a symbol-name in
> GNU Emacs Lisp?

I don't know if this a "clean" way to do this, but here goes anyway:

    (car (read-from-string "foo"))              -->  foo
    (symbolp (car (read-from-string "foo")))    -->  t

-- Ashwin.

kgk@cs.brown.edu (05/01/89)

In article <1256@novavax.UUCP> weiner@novavax.UUCP (Bob Weiner) writes:

   Anyone know if there is a way to convert a string to a symbol-name in
   GNU Emacs Lisp?

What is the distinction between a string and a symbol-name?  I don't
think that it is easy or a good idea to access to the name cell of
symbols; if you mean a function that given a string creates a symbol
whose symbol-name is equal to the string, then

(intern "foo") -> symbol named foo


Keiji Kanazawa
kgk@cs.brown.edu

rbj@dsys.icst.nbs.GOV (Root Boy Jim) (05/03/89)

? From: brunix!doorknob!kgk@uunet.uu.net

? In article <1256@novavax.UUCP> weiner@novavax.UUCP (Bob Weiner) writes:

?    Anyone know if there is a way to convert a string to a symbol-name in
?    GNU Emacs Lisp?

? What is the distinction between a string and a symbol-name?  

None.

? I don't
? think that it is easy or a good idea to access to the name cell of
? symbols; 

Why not? Well, maybe not modify it...

?if you mean a function that given a string creates a symbol
? whose symbol-name is equal to the string, then

? (intern "foo") -> symbol named foo

Correct. I used to think intern was broken, but that was because I never
did anything with the symbol intern returned.

On the other hand, make-symbol is supposed to create an uninterned symbol.

Consider:

	qwerty
Symbol's value as variable is void: qwerty
	(set (intern "qwerty") 5)
5
	qwerty
5
	poiuyt
Symbol's value as variable is void: poiuyt
	(set (make-symbol "poiuyt") 6)
6
	poiuyt
Symbol's value as variable is void: poiuyt

? Keiji Kanazawa
? kgk@cs.brown.edu

	Root Boy Jim is what I am
	Are you what you are or what?