Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Symbol vs. String ???
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dave Seaman  
View profile  
 More options Aug 21 1995, 3:00 am
Newsgroups: comp.lang.lisp
From: a...@seaman.cc.purdue.edu (Dave Seaman)
Date: 1995/08/21
Subject: Re: Symbol vs. String ???
In article <41aeo3$...@pretzel.cs.huji.ac.il>,

Alexander Serebrenik <alic...@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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alexander Serebrenik  
View profile  
 More options Aug 21 1995, 3:00 am
Newsgroups: comp.lang.lisp
From: alic...@pita.cs.huji.ac.il (Alexander Serebrenik)
Date: 1995/08/21
Subject: Symbol vs. String ???
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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options Aug 21 1995, 3:00 am
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.no>
Date: 1995/08/21
Subject: Re: Symbol vs. String ???
[Alexander Serebrenik]

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

use `print' instead of `princ'.

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »