Maxima interface to Lisp bit-functions



On 3/23/08, Stavros Macrakis <macrakis at alum.mit.edu> wrote:

>  One of the things that makes Maxima (relatively) easy to use is
>  precisely the lack of declarations.  We don't require the user to
>  declare x as a non-zero real to allow 1/x, and he can even substitute
>  false or matrix([2,3],[4,6]) for x later.

Yeah --- essentially Maxima has been written with an assortment
of common-sensical assumptions which are pretty well matched
to what typical users want. That does make it very convenient.
The down side, as I'm sure you know, is that those assumptions
are not spelled out anywhere ("self-documenting code", ha ha ha),
and it is more or less impossible to retract those assumptions,
and therefore difficult to work in domains for which the common-
sense assumptions don't hold.

>  Not allowing bit_and(x,x) => x and bit_and(x,bit_not(x)) => 0 and
>  bit_or(x,bit_not(x)) => -1 without explicit declarations of x as an
>  integer would make using bit_xxx far more clumsy, and I'm not sure it
>  would prevent any real errors.

Yeah, it's probably OK to allow such operations.

>  Just to surprise you more, I might even think that treating false as 0
>  and true as -1 in the context of bit operations makes sense, e.g.
>  bit_and(23,true) => 23; bit_not(true) => 0.

I don't see the point of this.

You're certainly right, I am indeed surprised.

best

Robert Dodier