From: Pionkowski
Subject: integer to string conversion
Date: 
Message-ID: <1998051415594500.LAA03222@ladder03.news.aol.com>
How do I convert an integer to a string?
 for ex:    i  is 3 ...   given i , how do I coerce it to:    "3"

thanks, Rick Pionkowski
··········@aol.com

From: Kent M Pitman
Subject: Re: integer to string conversion
Date: 
Message-ID: <sfw90o4iww0.fsf@world.std.com>
··········@aol.com (Pionkowski) writes:

> How do I convert an integer to a string?
>  for ex:    i  is 3 ...   given i , how do I coerce it to:    "3"
> 
> thanks, Rick Pionkowski
> ··········@aol.com

According to taste, one of these:

(write-to-string 3 :base 10 :radix nil)

(format nil "~D" 3)
From: Kiritsuke
Subject: Re: integer to string conversion
Date: 
Message-ID: <356606D4.6358@nwlink.com>
Pionkowski wrote:
> 
> How do I convert an integer to a string?
>  for ex:    i  is 3 ...   given i , how do I coerce it to:    "3"
> 
> thanks, Rick Pionkowski
> ··········@aol.com

(defun string-value-of (x)
  (princ-to-string x)
)

Kiritsuke
ICAD Weenie
From: Kent M Pitman
Subject: Re: integer to string conversion
Date: 
Message-ID: <sfwra1lvwhz.fsf@world.std.com>
Kiritsuke <··@nwlink.com> writes:

> Pionkowski wrote:
> > How do I convert an integer to a string?
> 
> (defun string-value-of (x) (princ-to-string x))

Although this is heavily used, robust code is better off to use
(WRITE-TO-STRING x :BASE 10 :RADIX NIL)
so that it is insulated from the effects of *PRINT-BASE* and *PRINT-RADIX*.

Using (FORMAT NIL "~D" x) mostly also works but may be a bit more overhead.