number formats



On 5/7/07, Robert Dodier <robert.dodier at gmail.com> wrote:
>
> This topic comes up from time to time. Last time I proposed
> essentially the same modification (the code was slightly different)
> it was rejected. See:
> http://www.math.utexas.edu/pipermail/maxima/2006/001887.html
> I'll take this opportunity to propose it again. Any objections?
>

Yes.  Exactly the same objections as last time: that it would be a bad idea
to change the interpretation of strings like a (a symbol), 1b2 (a bfloat),
and 2e3 (a float) when ibase changes.

I propose a two-part solution:

   - In regular, parsed, input, tokens starting with initial 0 are parsed
   as numbers, so in ibase=2^4:

0a = 10.
01b2 = 434.
02e3 = 739.

   - That there be a separate "read" function (read_integer, say), which
   reads one integer in the current input base:

(%i23) ibase: 2^4$
(%i24) a-1;
(%o24) a-1
(%i25) read_integer("Number, please:")-1
Number, please:
a
(%o25) 9

This way, there is no ambiguity. (Well, I suppose it keeps you from doing
infix("a"), but....

                 -s