[Maxima] ibase and obase
l.couraud at gmail.com
Mon Jun 19 15:28:08 CDT 2006
Is it really necessary to specify the base in the input?
Because we have ibase. I think you don't have the need to specify it.
(%i3) ibase : 10;
(%i5) ibase : 16;
> -----Message d'origine-----
> De : maxima-admin at math.utexas.edu
> [mailto:maxima-admin at math.utexas.edu] De la part de Robert Dodier
> Envoyé : lundi 19 juin 2006 16:50
> À : macrakis at alum.mit.edu
> Cc : Maxima at math.utexas.edu
> Objet : Re: [Maxima] ibase and obase
> On 6/19/06, Stavros Macrakis <macrakis at gmail.com> wrote:
> > Input in bases > 10 is occasionally useful, I agree.
> > But only occasionally.
> Yes, and on those rare occasions, I want to get some
> useful behavior, instead of "Why doesn't this work?"
> > It would be a bad idea to break longstanding, useful syntax such as
> > ordinary variable names (a, b, c), floating-point numbers (2e3 =
> > 2000), initial zeroes (00777 = 777) and the dot operator
> > (non-commutative multiplication) (aa.bb = "."(aa,bb) ) to
> > large bases.
> If I tell Maxima "Treat everything from a to z as a digit"
> the best I can hope for is that a, b, c, 2e3, etc become
> integers. If that's not what I want, then I won't change ibase.
> Common Lisp allows this same ambiguity, and somehow
> it staggers ahead unimpeded.
> > What's more, using global variables like ibase/obase means
> that every
> > loadfile etc. needs to be careful.
> This is beside the point -- ibase and obase already exist
> and already have the potential to goof up any/every bit
> of code by changing the global environment, just like any
> other global variable.
> > This is very occasionally useful,
> Yes, so one would only change ibase if they thought it useful.
> > but perhaps even better would be a syntax that explicitly specifies
> > the base, so that input and output are unambiguous.
> I'm not opposed to that, although I wonder what is an
> acceptable notation.
> > Or maybe sticking with the functional solution
> > base("A0",12)
> base(A0, 12) is OK by me (I'd rather get rid of the quote
> marks). The hard part of this, at present, is persuading the
> input scanner to let through stuff like 3A0 -- at present
> this triggers "A is not an infix operator" or some such.
> base(\3A0, 12) would work. Well, it's ugly.
> Robert Dodier
> Maxima mailing list
> Maxima at math.utexas.edu
More information about the Maxima