From: Alexander Serebrenik
Subject: Symbol vs. String ???
Date: 
Message-ID: <41aeo3$78l@pretzel.cs.huji.ac.il>
Hi to everybody !

I've a small problem - may be some of you already met it and know how
it may be solved ?
The problem is as follows - i've the variable representing string,
f.e. (defvar x "xxx")
Now i want to translate x to something representing `|"xxx"| .
How can i do it ? (i'm working with currently existing
 module which combines structures and afterwards prints them with
help of PRINC and the only way i found to print the string storing
it as a STRING with the help of princ is to write
	(princ `|"xxx"|)
The problem is that the string may be variable ...

		Thanks, sincerely ,
			Alexander

From: Dave Seaman
Subject: Re: Symbol vs. String ???
Date: 
Message-ID: <41akja$741@seaman.cc.purdue.edu>
In article <··········@pretzel.cs.huji.ac.il>,
Alexander Serebrenik <·······@pita.cs.huji.ac.il> wrote:
>The problem is as follows - i've the variable representing string,
>f.e. (defvar x "xxx")
>Now i want to translate x to something representing `|"xxx"| .

Do you really mean you want to produce a symbol whose print name is
|"xxx"|, or are you only concerned with printing the string, complete
with quotes, but without producing an interned symbol?

>How can i do it ? (i'm working with currently existing
> module which combines structures and afterwards prints them with
>help of PRINC and the only way i found to print the string storing
>it as a STRING with the help of princ is to write
>	(princ `|"xxx"|)
>The problem is that the string may be variable ...

You should probably begin by exploring the difference between prin1 and
princ, since I suspect that will solve your problem.  The difference is
that princ prints a string without any surrounding quotes, while prin1
includes the quotes.  In particular, (prin1 x) in your example will
produce the same output as (princ '|"xxx"|).

If that is not what you are looking for, perhaps you should try
something along the lines of the following:

>(defvar y (format nil "|~s|" x))
Y
 
>y
"|\"xxx\"|"
 
>(read-from-string y)
|"xxx"|
7
 
>

The value of y is a string, but the value you get from (read-from-string y)
is actually a symbol whose print name is as you indicated.

Dave Seaman
From: Erik Naggum
Subject: Re: Symbol vs. String ???
Date: 
Message-ID: <19950821T191729Z@naggum.no>
[Alexander Serebrenik]

|   [incredibly painful "solution" deleted to protect the children]

use `print' instead of `princ'.

#<Erik 3018021449>
-- 
trigraph ??!??! die