bilinear defrule



On 11/30/10, Edwin Woollett <woollett at charter.net> wrote:

> matchdeclare ([aa, bb, cc], all);
>
> defrule (rbilineara1, xx (aa + bb, cc), map (lambda ([u], xx (u, cc)), bb));
> defrule (rbilineara2, xx (cc, aa + bb), map (lambda ([u], xx (cc, u)), bb));

> I don't understand why rule rbilineara1 definition in terms
> of the lambda function doesn't refer to aa as well as bb.
> How is your definition able to get the job done?

Well, I just want to match any "+" expression.
I could write matchdeclare(pp, lambda([e], not atom(e) and op(e) = "+"))
and then defrule(rfoo, xx(pp, aa), map(lambda([u], xx(u, aa)), pp),
but I wanted the "+" to appear in the defrule so it's easier to see what
kind of expression is matched. I would like to write
defrule(rfoo, xx("+"(aa), cc), ....) but that doesn't seem to work as
expected; that might be a bug in defrule.

Since aa and bb match the same things (anything), one of them will
absorb all of the "+" arguments, and the other will be 0.
Trial and error suggested that bb is the one that will get all the arguments,
so I ignored aa.

Hope this clears it up a little ...

Robert Dodier