Maxima interface to Lisp bit-functions



On Tue, Mar 18, 2008 at 11:02 AM, Robert Dodier <robert.dodier at gmail.com> wrote:
>  (6) The and, or, xor, and eqv functions should be declared
>  commutative --- Maxima knows a little bit about such functions,
>  and any extensions to the treatment of commutative functions
>  would help these functions too.

Yes, that will help until a simplifier is written.

>  (7) Is the eqv function really needed? isn't eqv(x, y) iff is(x = y) ??

Yes, for boolean variables b1, b2, eqv(b1,b2)==is(b1=b2).  But bit_eqv
is about a vector of such variables.
bit_eqv(a,b)==bit_not(bit_xor(a,b)).

>  >  integer_length(int):  length of the bit representation
>  (8) This name seems problematic. How about something narrower
>  such as integer_log2 or floor_log2 ?
>  (9) Also I wouldn't try to define this for negative integers -- seems
>  too ambiguous. Let the user write floor_log2(abs(n)) to make it clear.

Yes, I agree that integer_length is a difficult concept.

>  (7) This is OK by me. Extending these functions to rational
>  non-integers or whatever is OK too, but that is something
>  we can add later if we want.

Agreed.  Especially because the .111111.... case is problematic. I
just didn't want to preempt that case.

           -s