Nicolas Troquard <troquard@emi.u-bordeaux.fr> wrote:
+---------------
| Is there any function (number2string 8) => "8" that exists?
+---------------
If you are asking because you are coming from a Scheme background,
then what you probably really wanted was this:
> (defun number->string (number &optional (radix 10))
(format nil "~vr" radix number))
NUMBER->STRING
> (number->string (+ 3 5))
"8"
> (number->string (expt 2 32))
"4294967296"
> (number->string (expt 2 32) 8)
"40000000000"
> (number->string (expt 2 32) 16)
"100000000"
>
However, unlike Scheme, which requires the radix to be one of 2, 8,
10, or 16, Common Lisp permits any value between 2 and 36 inclusive:
> (number->string (expt 2 32) 5)
"32244002423141"
> (number->string (expt 2 32) 36)
"1Z141Z4"
>
-Rob
-----
Rob Warnock, PP-ASEL-IA <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607