Re: *print-base*

Edi Weitz <[email protected]> 01 Aug 2003 21:24:12 +0200
Newsgroups gmane.lisp.openmcl.bugs
Message-ID <[email protected]>
On Thu, 31 Jul 2003 19:10:26 -0400, Paul <[email protected]> wrote:

> The below transcript should be fairly self-explanatory.
> 
> Welcome to OpenMCL Version (Alpha: Darwin) 0.14-030623!
> ? (setf *print-base* 16)
> 10
> ? *print-base*
> 10
> 
> This seems rather broken to me.

But it's correct. You wanted numbers to be printed as hexadecimals and
16 (decimal) is '10' when printed as an hexadecimal.

Here's what CMUCL does. I'm sure every self-respecting CL
implementation will do the same:

  * (setf *print-base* 16)

  10
  * *print-base*

  10
  * 10

  A
  * (format nil "~X" 16)

  "10"
  * (setf *read-base* 16)

  10
  * (format nil "~X" 10)

  "10"
  * 10

  10

Edi.