From: lama
Subject: how to convert a number to a string?
Date: 
Message-ID: <bg9m1v$269$1@news-int.gatech.edu>
I am trying to concatenate a symbol and number into a symbol. I am kinda 
a newbie so I am not that familiar with lisp API. Here is how i thought 
about doing it.

A - convert the symbol to a string.
B - convert the number to a string.
C - concatenate the two above values.
D - Intern the resulting string.

I can do steps A, C, D using symbol-name, concatenate, and Intern 
functions respectively. However I don't know of a function that converts 
a number to a string. So help me out here with step B...

Also is there another way of doing all of this.

Thanx.

From: Erann Gat
Subject: Re: how to convert a number to a string?
Date: 
Message-ID: <gat-3007031716590001@k-137-79-50-101.jpl.nasa.gov>
In article <············@news-int.gatech.edu>, lama <····@yahoo.com> wrote:

> I am trying to concatenate a symbol and number into a symbol. I am kinda 
> a newbie so I am not that familiar with lisp API. Here is how i thought 
> about doing it.
> 
> A - convert the symbol to a string.
> B - convert the number to a string.
> C - concatenate the two above values.
> D - Intern the resulting string.
> 
> I can do steps A, C, D using symbol-name, concatenate, and Intern 
> functions respectively. However I don't know of a function that converts 
> a number to a string. So help me out here with step B...

princ-to-string

> Also is there another way of doing all of this.

You can use make-symbol instead of intern.  But you're basically doing it
right.  However, it's almost certainly not what you really want to do,
especially if you're a newbie.  So you're probably doing the wrong thing,
but you're doing it correctly.

:-)

E.
From: John M. Adams
Subject: Re: how to convert a number to a string?
Date: 
Message-ID: <oqak79zr1xs.fsf@RAKTABIJA.stsci.edu>
lama <····@yahoo.com> writes:

> I am trying to concatenate a symbol and number into a symbol. I am
> kinda a newbie so I am not that familiar with lisp API. Here is how i
> thought about doing it.
> 
> A - convert the symbol to a string.
> B - convert the number to a string.
> C - concatenate the two above values.
> D - Intern the resulting string.
> 
> I can do steps A, C, D using symbol-name, concatenate, and Intern
> functions respectively. However I don't know of a function that
> converts a number to a string. So help me out here with step B...
> 
> Also is there another way of doing all of this.

You can pass (format nil "~a~a" 'X 0) to either intern or make-symbol.

-- 
John M. Adams
From: Louis Theran
Subject: Re: how to convert a number to a string?
Date: 
Message-ID: <a2503e25.0307310834.4c78ca7a@posting.google.com>
·······@stsci.edu (John M. Adams) writes:
> You can pass (format nil "~a~a" 'X 0) to either intern or make-symbol.

This is sensitive to the value of *print-case*, at least.  You can use
with-standard-io-syntax to avoid that problem, but then you need to
make sure to rebind *package*.

^L
From: Steven M. Haflich
Subject: Re: how to convert a number to a string?
Date: 
Message-ID: <Il8Xa.100$ax.10569745@newssvr13.news.prodigy.com>
Louis Theran wrote:

> ·······@stsci.edu (John M. Adams) writes:
> 
>>You can pass (format nil "~a~a" 'X 0) to either intern or make-symbol.
> 
> 
> This is sensitive to the value of *print-case*, at least.  You can use
> with-standard-io-syntax to avoid that problem, but then you need to
> make sure to rebind *package*.

Also *print-radix* and *print-base*, but you can bypass all three
without the overhead of with-standard-io-syntax with this simple
idiom:

(format nil "~d~d" 'X 0)
From: Louis Theran
Subject: Re: how to convert a number to a string?
Date: 
Message-ID: <a2503e25.0308031600.fd0ac58@posting.google.com>
"Steven M. Haflich" <·················@alum.mit.edu> writes:
> Louis Theran wrote:
> > This is sensitive to the value of *print-case*, at least.  
> Also *print-radix* and *print-base*, but you can bypass all three
> without the overhead of with-standard-io-syntax with this simple
> idiom:
> 
> (format nil "~d~d" 'X 0)

Since ~d falls back to ~a, this doesn't address the *print-case*
issue.  For example, the following probably isn't the desired result.

  ? *print-case*
  :downcase
  ? (intern (format nil "~d~d" 'X 0))
  \x0
  nil
  ? (eq 'x0 *)
  nil
  ? (eq '|x0| **)
  t

^L
From: Joe Marshall
Subject: Re: how to convert a number to a string?
Date: 
Message-ID: <vftikehq.fsf@ccs.neu.edu>
lama <····@yahoo.com> writes:

> I am trying to concatenate a symbol and number into a symbol. I am
> kinda a newbie so I am not that familiar with lisp API. Here is how i
> thought about doing it.
>
> A - convert the symbol to a string.
> B - convert the number to a string.
> C - concatenate the two above values.
> D - Intern the resulting string.

Intern the resulting string in what package?
From: OCID
Subject: Re: how to convert a number to a string?
Date: 
Message-ID: <bge215$qhi$1@mozo.cc.purdue.edu>
Something like this?

(string (digit-char 2))

"lama" <····@yahoo.com> wrote in message
·················@news-int.gatech.edu...
> I am trying to concatenate a symbol and number into a symbol. I am kinda
> a newbie so I am not that familiar with lisp API. Here is how i thought
> about doing it.
>
> A - convert the symbol to a string.
> B - convert the number to a string.
> C - concatenate the two above values.
> D - Intern the resulting string.
>
> I can do steps A, C, D using symbol-name, concatenate, and Intern
> functions respectively. However I don't know of a function that converts
> a number to a string. So help me out here with step B...
>
> Also is there another way of doing all of this.
>
> Thanx.
>