In article <1992Nov3.220518.9744@tamsun.tamu.edu> apj6796@tamsun.tamu.edu (Albert Paul Jimenez III ) writes:
>
>
>
>3) anyone got any more documentation on this thing?
> hopefully including a way to specify which occurance to substitute in for
> (# of possible subs is on lvl 1 after the MATCH cmd) so i can do simple communative swapping on say, just the 2nd _AND_ in '(A AND B) OR (C AND D)' instead of haveing to swap the whole thing with << { '&1 AND &2' '&2 AND &1' } ?MATCH DROP >>
>
>A bit of non-cents from me to you...
Well, I have found a couple of neat things using the match command...
I always wanted to do Laplace Transforms using the match command, but had some trouble
because I wanted to know exactly WHAT was substituted. (I don't remember why now)
Say I had 'X^2+Y^2' and did a { '&A^2' '&A*&A' } and wanted to know what &A was
after the substitution (which I believe occurs one at a time, putting a ONE on
the stack if a substituion was made (Useful for do-until-done matching)) So I did
this.
'X^2+Y^2'
{ '&A^2' '&A*&A' '&A==MYPROG' }
MATCH?
Where MYPROG was a program that looked at level one on the stack,
which happened to be &A! (X in this case). This way, I could
check to see if I should transform '1/&A^2' using rules for
'1/S^2' or 1/(S+2)^2. MYPROG also has to return two equal values to the stack
so that the equality can become true and a substitution will occur.
(Or two unequal values if you decide that the substituion is not
appropriate.) Let me know if you find this helpful or need further help
understanding what I tried to say. Happy matching!