matchdeclare matching functions or an alternative?



On 2013-02-23, Mike Valenzuela <mickle.mouse at gmail.com> wrote:

> I am wondering if there is a way to use matchdeclare to do the following:
>
> matchdeclare(ff(xx), isfunction(ff,xx))
> Where ff is supposed to be a function of xx.

I don't get it -- if an expression looks like ff(xx), then ff is a
function of xx, right? What is an example of an expression ff(xx) in
which ff is not a function of xx? Maybe you can give some more examples.

Couple of things that might help. defrule (not tellsimp / tellsimpafter,
not sure about defmatch) allows for the main operator of a match
expression to be a variable. So you could have s.t. like

    matchdeclare (foo, lambda ([e], member (e, [sin, cos, tan])));
    defrule (r1, foo (something), whatever (foo, something));

to match trig functions. Other thing is that match variables are bound
during matching, so you can have a match predicate for one variable
which depends on other variables. However that's sensitive to the order
in which variables are bound and therefore obscure and/or fragile.

best

Robert Dodier