This is a case where a pattern seems to match, but it doesn't match!?
Anybody knows why?
Regards,
Martin
/*Declare patterns for f and for an atom.*/
(%i1) matchdeclare(
fpat, fp,
atompat, atom
);
(%o1) done
(%i2) fp(e) := (atom(e) and e=f);
(%o2) fp(e):=atom(e) and e=f
(%i3) expr: a*b*f;
(%o3) a*b*f
/*Declare a rule that tests for a product of an atom and f.
Return the factors as well as the pattern match results.*/
(%i4) defrule(
prodrul,
atompat*fpat,
baz(atompat, atom(atompat), fpat, fp(fpat))
);
fpat*atompat partitions `product'
(%o4) prodrul:atompat*fpat->baz(atompat,atom(atompat),fpat,fp(fpat))
/*Why does the rule think it applies, and the patterns do not match at
the same time?*/
(%i5) apply1(expr, prodrul);
(%o5) baz(a*b,false,f,true)