From: ····@vladimir.ucsb.edu
Subject: Lisp strings
Date: 
Message-ID: <1174@ucsbcsl.ucsb.edu>
Can anyone tell me how to remove the bars around the symbol name that results
from the intern function.  The symbol-name function, and character stream
format return strings.


What I'm actually trying to do is to convert a string to a symbol.

From: Barry Margolin
Subject: Re: Lisp strings
Date: 
Message-ID: <1991Aug22.052845.19472@Think.COM>
In article <····@ucsbcsl.ucsb.edu> ····@vladimir.ucsb.edu writes:
>Can anyone tell me how to remove the bars around the symbol name that results
>from the intern function.  The symbol-name function, and character stream
>format return strings.
>
>What I'm actually trying to do is to convert a string to a symbol.

INTERN and MAKE-SYMBOL will convert a string to a symbol (the only
difference is that MAKE-SYMBOL doesn't intern the symbol into a package).

Neither of these functions puts bars around the symbol name.  Rather, when
symbols are *printed*, vertical bars or backslashes are displayed if the
symbol contains any characters that would normally be processed specially
the Lisp reader.  For instance, this will be done if the symbol name
contains lowercase characters (which the reader would normally convert to
uppercase) or delimiters.  The purpose is to print the symbol in the same
way that you would have to type it to get the same symbol.

Perhaps what you want to do is (intern (string-upcase <string>)).  But
you'll still get vertical bars or slashes if <string> contains delimiters.


-- 
Barry Margolin, Thinking Machines Corp.

······@think.com
{uunet,harvard}!think!barmar
From: Douglas S. Rand
Subject: Re: Lisp strings
Date: 
Message-ID: <DSR.91Aug26100624@chickpea.mitre.org>
In article <····@ucsbcsl.ucsb.edu> ····@vladimir.ucsb.edu writes:

   Can anyone tell me how to remove the bars around the symbol name that results
   from the intern function.  The symbol-name function, and character stream
   format return strings.


   What I'm actually trying to do is to convert a string to a symbol.

I'm probably the fifth person to tell you.  INTERN takes a string and
creates a symbol.  By default the READER converts all symbols read in
to uppercase.  These symbols need no quotes,  the bars you see,  to be
disambiguous.  When you use INTERN you are bypassing this mechanism in
the reader.  LISP symbols are case unique.

To avoid the problem use STRING-UPCASE first:

(intern (string-upcase the-string)) -> unquoted symbol

--
Douglas S. Rand 
Internet:   <······@mitre.org>
Snail:	    MITRE, Burlington Road, Bedford, MA 
Disclaimer: MITRE might agree with me - then again...
Amateur Radio: KC1KJ