[Maxima] the 'take' macro

Stavros Macrakis macrakis at alum.mit.edu
Fri Apr 27 10:41:00 CDT 2007


On 4/27/07, Barton Willis <willisb at unk.edu> wrote:
>
> The 'take' macro (defined in mopers.lisp) special cases
> the operators mabs, %cos, and a few more. For these
> cases, 'take' sends the expression directly to the
> simplification function instead of going through
> simplifya. I think this could cause bugs with tellsimp:


I think you are right.  I wrote the take macro in 1974 or so and probably
was over-concerned with efficiency and under-concerned with the effects on
tellsimp etc.

(defmacro take (op &rest args &aux simplifier)
>   (if simplifier `(,simplifier (list ,operator . ,args) 1 t)
>     `(simplifya ((,op) , at args) t)))


&aux is just a way of defining local variables -- shortcut for (let (...)
...) -- so you can remove that entirely.

As for
        `(simplifya ((,op) , at args) t)))
this should be
        `(simplifya (list '(,op) , at args) t)
I suppose there must be some way to do this with nested backquotes, but I
would rather avoid that complication.

I don't know if the bugs you got were because of this; they don't look
related.

                -s
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20070427/c0857954/attachment-0001.htm 


More information about the Maxima mailing list