Artifact f1cc35e7b44e4f1c40bd3188df82a9e9c43bb443f408eb5b42cf547fb47a73b5:
- Executable file
r37/lisp/csl/html/r37_0205.html
— part of check-in
[f2fda60abd]
at
2011-09-02 18:13:33
on branch master
— Some historical releases purely for archival purposes
git-svn-id: https://svn.code.sf.net/p/reduce-algebra/code/trunk/historical@1375 2bfe0521-f11c-4a00-b80e-6202646ff360 (user: arthurcnorman@users.sourceforge.net, size: 2252) [annotate] [blame] [check-ins using] [more...]
<A NAME=MATCH> <TITLE>MATCH</TITLE></A> <b><a href=r37_idx.html>INDEX</a></b><p><p> <B>MATCH</B> _ _ _ _ _ _ _ _ _ _ _ _ <B>command</B><P> <P> <P> <P> The <em>match</em> command is similar to the <A HREF=r37_0199.html>let</A> command, except that it matches only explicit powers in substitution. <P> <H3> syntax: </H3> <P> <P> <em>match</em><expr> <em>=</em> <expression>{,<expr> <em>=</em><expression>}* <P> <P> <P> <expr> is generally a term involving powers, and is limited by the rules for the <A HREF=r37_0199.html>let</A> command. <expression> may be any valid REDUCE scalar expression. <P> <P> <P> <H3> examples: </H3> <P><PRE><TT> match c**2*a**2 = d; (a+c)**4; 4 3 3 4 A + 4*A *C + 4*A*C + C + 6*D match a+b = c; a + 2*b; B + C (a + b + c)**2; 2 2 2 A - B + 2*B*C + 3*C clear a+b; (a + b + c)**2; 2 2 2 A + 2*A*B + 2*A*C + B + 2*B*C + C let p*r = s; match p*q = ss; (a + p*r)**2; 2 2 A + 2*A*S + S (a + p*q)**2; 2 2 2 A + 2*A*SS + P *Q </TT></PRE><P>Note in the last example that <em>a + b</em> has been explicitly m atched after the squaring was done, replacing each single power of <em>a</em> by <em>c - b</em>. This kind of substitution, although following the rules, is confusing and could lead to unrecognizable results. It is better to use <em>match</em> with explicit powers or products only. <em>match</em> should not be used inside procedures for the same reasons that <em>let</em> should not be. <P> <P> Unlike <A HREF=r37_0199.html>let</A> substitutions, <em>match</em> substitutions are ex ecuted after all other operations are complete. The last example shows the difference. <em>match</em> commands can be cleared by using <A HREF=r37_0189.html>clear</A>, with exactly the expression that the original <em>match</em> took. <em>match</em> commands can also be done more generally with <em>for all</em> or <A HREF=r37_0195.html>forall</A>...<em>such that</em> commands. <P> <P> <P>