ibase and obase



in the
Line %i2, below,  the ibase is not set to 16 when the symbol "a" is read.
If you want to see the scope of ibase, you would have to do something like

Block([ibase:8], x:read()).

In this example, if you type 10; it will be read as octal.

RJF


-----Original Message-----
From: maxima-admin at math.utexas.edu [mailto:maxima-admin at math.utexas.edu] On
Behalf Of van Nek
Sent: Tuesday, June 20, 2006 8:23 AM
To: Robert Dodier
Cc: Maxima at math.utexas.edu
Subject: Re: [Maxima] ibase and obase

Am 18 Jun 2006 um 22:20 hat Robert Dodier geschrieben:
 
> For the record here is a reimplementation of ascii-numberp
> and some examples. Note the use of the trailing decimal point
> to indicate an integer in base 10; this is a useful Lisp-ism inherited
> by Maxima.
> 
> (defun ascii-numberp (putative-digit)
>   (and
>    (characterp putative-digit)
>    (find
>     (char-downcase putative-digit)
>     (subseq "0123456789abcdefghijklmnopqrstuvwxyz" 0 *read-base*))))
> 

Hi Robert,

I have loaded this code and tried it out.

(%i2) block( [ibase:16], a );
(%o2) 				       a
(%i3) block( ibase:16, a );
(%o3) 				       a
(%i4) a;
(%o4) 				      10

An assignment to ibase in a block doesn't have any consequence inside the
block itself.
Does it make sense then, if this only works in top level?

Maybe one could think about implementing bytestrings.

Volker

_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima