PART+, was: Re: [Maxima] Yet another units package



--- Robert Dodier  wrote:
> > For example, in a fresh session,
> > 
> > matchdeclare(%b%,atom);
> > const_true(x):=true;
> > /* Btw, simply `true' ought to work, too */ 
> > matchdeclare(%a%,const_true);
> > defmatch(foo,%b%+%a%);
> > foo(x+y+y^2+z+cos(x));
> > 
> > used to give
> >                          2
> > [%b% = z + y + x, %a% = y  + cos(x)]
> > 
> > but with your changes in PART+ (src/matrun.lisp) it now gives
> > `false'.
> 
> I don't think we want to reproduce this, since it
> is incorrect:  atom(z + y + x) => false.

But the above behavior is useful, so how would we reproduce the result 
                          2
 [%b% = z + y + x, %a% = y  + cos(x)]

with tellsimp, if not by the above method?

> I want PART+ and PART* to act correctly, but the behavior
> of the previous version gives rather weak guidance; it is
> easy to find examples in which it is strange, or flatly wrong. 

I suspect it's a case of useful vs. correct, and also a question of
notation.

> At this point I have two suggestions. (1) Why don't we steer 
> the discussion towards how we want matching of + and * to work.
> I will revise PART+/PART* as needed to make it conform.
> (2) If you have some examples (existing or made-up, trivial
> or nontrivial) which exercise PART+/PART*, I will be very
> much obliged if you send them to me. I have a set of test
> cases, but clearly it isn't large enough.

Can I ask a silly question?  What is the order in which rules are
applied?  The order in which they were defined?  This might make a big
difference to the result, depending on the expression.
 
CY

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com