From: Matthew Economou
Subject: Q: Parsing numbers
Date: 
Message-ID: <w4oso2ctm7g.fsf@nemesis.irtnog.org>
My apologies in advance, as this is a really minor nit to pick.

Section 2.3.1 of the CLHS describes an integer (and the mantissa of a
float) as consisting exclusively of decimal digits, whereas the
numerator and denominator of a ratio and the exponent of a float can
be digits in whatever is the current *READ-BASE*.

This seems to be at odds with the definition of *READ-BASE*, and with
the Lisp reader implementations in GCL, CMU CL and Clisp (I don't have
ACL or LW available to test).  Which behavior is correct: to accept
only decimal digits in certain parts of a numeric token regardless of
the setting of *READ-BASE*, or to honor *READ-BASE* at all times and
(seemingly) violate the spec?

-- 
"I'm very busy.  I'm preparing my next mistake." -- B. Brecht

From: Arthur Lemmens
Subject: Re: Q: Parsing numbers
Date: 
Message-ID: <382C29F2.F2608C88@simplex.nl>
Matthew Economou wrote:

> Section 2.3.1 of the CLHS describes an integer (and the mantissa of a
> float) as consisting exclusively of decimal digits, whereas the
> numerator and denominator of a ratio and the exponent of a float can
> be digits in whatever is the current *READ-BASE*.

I think you're misreading the spec.
It says:

  integer        ::=  [sign]
                                   decimal-digit+
                                   decimal-point |
                                   [sign]
                                   digit+      

or, changing the layout a bit:

  integer        ::=    [sign] decimal-digit+ decimal-point 
                     |  [sign] digit+      


In other word: an integer consists of an optional sign, followed by either:
  - one or more decimal digits, followed by a decimal-point
  - or: one or more digits (not necessarily decimal digits!)

> Which behavior is correct: to accept only decimal digits in certain parts 
> of a numeric token regardless of the setting of *READ-BASE*, or to honor 
> *READ-BASE* at all times and (seemingly) violate the spec?

I see no reason not to honor *READ-BASE*.

--
Arthur Lemmens
From: Pekka P. Pirinen
Subject: Re: Q: Parsing numbers
Date: 
Message-ID: <ixr9hva8ph.fsf@gaspode.cam.harlequin.co.uk>
Matthew Economou <········@irtnog.org> writes:
> Section 2.3.1 of the CLHS describes an integer (and the mantissa of a
> float) as consisting exclusively of decimal digits, whereas the
> numerator and denominator of a ratio and the exponent of a float can
> be digits in whatever is the current *READ-BASE*.

Integers are OK, you missed the alternate clause that specifies
"[sign] digit+" which does obey *READ-BASE*.  Floating point numbers
are meant to always be decimal, so the error is in the syntax for
"exponent" which specifies "exponent-marker [sign] {digit}+" and hence
implies that it depends on *READ-BASE*.  This is an editorial error;
2.3.2.2 does say exponent specifications are in decimal.

> "I'm very busy.  I'm preparing my next mistake." -- B. Brecht
-- 
Pekka P. Pirinen, Adaptive Memory Management Group, Harlequin Limited
          "A computer lets you make more mistakes faster than any
invention in human history with the possible exceptions of handguns
and tequila."        Mitch Ratliffe, _Technology Review_ April, 1992