On 5/9/07, Richard Fateman <fateman at eecs.berkeley.edu> wrote:
>
> as for matching pp(a1+a2), I suggest you do this:
>
> matchdeclare(s,sum_of_two_atoms);
> sum_of_two_atoms(z):= not(atom(z)) and
> equal(part(z,0),"+") and length(z)=2 and
> atom(part(z,1))and atom(part(z,2)
>
First of all, I do understand that there are some difficult tradeoffs here.
But requiring a mathematical user (as opposed to a programmer) to write the
above rather than a1+a2 is problematic. Of course, the pattern a1+a2 is not
particularly useful or interesting mathematically -- it was a simplified
example
The original example was:
laplace(signum(x-a),x,s)
where x and s are symbols and a is an arbitrary expression that is free of x
(though that wasn't explicitly stated). That is a slightly less simple, but
mathematically meaningful, example.
How would you do that? Given the matcher's left-to-right scan, it would seem
that you'd have to first transform to laplacex(x,s,signum(x-a)), at which
point the matcher has no problem. Can you do better?
-s