[Maxima-commits] CVS: maxima/src gamma.lisp,1.44,1.45



Stavros Macrakis wrote:
> On Thu, Nov 19, 2009 at 9:44 AM, Raymond Toy <raymond.toy at stericsson.com> wrote:
>   
>> Stavros Macrakis wrote:
>>     
>>> I think the clean, general way to do this is to make DIV into a macro
>>> in mopers.lisp....
>>>       
>
>   
>> I haven't tried this out yet, but I agree that this is the best way.  I
>> don't think you need to add a div2.  Leaving div as is and adding the
>> compiler macro should be enough.
>>     
>
> OK, define-compiler-macro was new to me -- I guess it is never used at
> runtime.  Is that really true?  Does it mean that you can't debug
> define-compiler-macro macros when running interpretively?  That seems
> problematic.
>
>   
I don't use define-compiler-macro very often, so I always have to look
at the CLHS to know.  I think the way to debug compiler macros is to do
what the examples in the CLHS does:

 (funcall (compiler-macro-function 'square) '(square x) nil)


(It seems that gcl doesn't have compiler-macro-function, but it must
have something to get the compiler-macro.  I don't know what it is.)

I also see that gcl doesn't have a compliant define-compiler-macro. The
spec says you can return the original form to decline expanding. But
this just causes gcl to overflow its stack.  We'll have to add a div2
like you did.

>> Incidentally, I see there's a div* that simplifies the result.
>>     
>
> No! No! No!  ALL the arithmetic functions simplify the result.  The
> difference between ARITH and ARITH* is that ARITH (like most Maxima
> functions) assumes that its *arguments* are simplified, and ARITH*
> does not.
>   
Right.  It's even documented near the top of the file.  Sorry, I missed
that.

Ray