apj6796@tamsun.tamu.edu (Albert Paul Jimenez III ) writes:
>1) documentation on the MATCH cmds is sadly lacking... there's what 1 & 1/2 pages and they do one simple example...
I agree. But there's really not much more that could be said. (up)MATCH
and (down)MATCH aren't really suited to that sort of thing, though they
do work.
>2) undocumented feature: as well as using & as a single wildcard, &1, &2, etc can also be used... helps to do more comples pattern matching
Well, it's not undocumented in the old manual. &U and &V keep popping up
in the examples.
>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 >>
The list can have two or three elements. If it has two, you get exactly
what you've been doing all along. Every occurrence gets replaced (well,
not *EVERY*, but you know what I mean). If there are three elements in the
list, then the third one is evaluated and the replacement ONLY goes ahead
if that evaluation turns out to be nonzero. To only replace the second in
your example, do
\<<
{ '&1 AND &2' '&2 AND &1' '&1==C' }
(up)MATCH @ (say)
DROP
\>>
(come to think of it, that won't work due to the symbolic nature of 'C',
but you get the idea.)
The RULES menu does this by operating on a string containing the algebraic,
I'm led to believe. It formats it for the EquationWriter, but all it
is is a string. Consult an expert on this. I'm not.
This is all in the manual, isn't it? Or isn't it in the new manual?