Newsgroups: comp.lang.lisp Path: utzoo!utgpu!cunews!dfs From: dfs@doe.carleton.ca (David F. Skoll) Subject: Re: string to symbol conversion Message-ID: Sender: news@cunews.carleton.ca Organization: Carleton University References: <80761@eerie.acsu.Buffalo.EDU> Distribution: na Date: Fri, 21 Jun 1991 16:10:08 GMT In <80761@eerie.acsu.Buffalo.EDU> lewocz@pegasus.cs.Buffalo.EDU (John S. Lewocz) writes: >Is there any way to convert an arbitrary string like "bob" into the >symbol bob in Common Lisp? If you don't have any weird characters in the string, (setq foo "bob") (read-from-string foo) ;; ---> The symbol BOB should work. If you have some weird characters, but no "bars" (|) in the string, then (setq foo "A #Bunch^&OfWeird**Cha#r$") (read-from-string (concatenate 'string "|" foo "|")) should do it. If your string contains "|", then it's tougher, and I don't feel like figuring it out right now. :-) (Of course, if you place bars around the string, you may not get the symbol in upper-case or whatever your Lisp's default is.) -- David F. Skoll