maxima - rules and patterns



On 3/3/08, Robert Marik <marik at mendelu.cz> wrote:

>  trylinear(expr):=(ev(ev(exprlin:expr,declare(derivace,linear)),
>  remove(derivace,linear)),remove(derivace,linear),exprlin)

Hmm. That seems too complicated; does the following work?

trylinear (expr) := (declare (derivace, linear), expr : ev (expr),
remove (derivace, linear), expr);

Something for the developers to think about -- it would be helpful to
have a construct like

assuming (p(x), q(x)) do (foo, bar, baz);

where p(x) and q(x) are some predicates such as featurep(x, linear).
This "assuming" construct would place whatever declarations are
necessary at the beginning and end, and just as importantly, catch
any errors or other stack unwinding, and restore the status quo ante.

Such a construct would be both neater and more nearly foolproof.
We've probably talked about such a thing before -- I'm just throwing
another stick on the fire.

FWIW

Robert Dodier