matchdeclare??



thanks a lot Robert.

2009/10/31 Robert Dodier <robert.dodier at gmail.com>

> Julien, consider a pattern-matching rule like this:
>
>  tellsimp (foo (aa), bar (aa));
>
> which replaces foo expressions with bar expressions.
> matchdeclare tells Maxima for what value of aa and bb
> this rule is applied. When there is a preceding
>
>  matchdeclare (aa, mumblep);
>
> the rule is applied when mumblep(aa) returns anything
> other than false. That is, matchdeclare specifies the
> predicate for matching variables in patterns.
>
> E.g. (1) match a literal integer
>
>  matchdeclare (aa, integerp);
>
> (2) match a symbol
>
>  matchdeclare (aa, symbolp);
>
> (3) match a non-atomic expression
>
>  matchdeclare (aa, lambda ([e], not atom (e)));
>
> In the absence of a matching predicate for aa, only
> a literal foo(aa) expression is matched.
>
> Hope this helps. If you have a particular problem in mind,
> maybe it would help focus the discussion.
>
> Robert Dodier
>