File: replace_match.tex

package info (click to toggle)
cadabra 1.46-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,244 kB
  • sloc: cpp: 33,188; ansic: 2,724; makefile: 329; yacc: 180; sh: 157; python: 45; lex: 38; lisp: 19
file content (22 lines) | stat: -rw-r--r-- 564 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
\cdbalgorithm{replace\_match}{}

Replaces a subset of terms in a sum or list which match the given
pattern. This is like a substitute, but always acting on entire terms. 
\begin{screen}{1,2}
A + B D G + C D A;
@replace_match!(%)( D Q?? -> 1);
A + 1;
\end{screen}
Note the difference with \subscommand{substitute},
\begin{screen}{1,2}
A + B D G + C D A;
@substitute!(%)( D Q?? -> 1);
A + G + A;
\end{screen}
See \subscommand{take\_match} for further details on how to use this
``select/modify/replace'' mechanism.


\cdbseealgo{take_match}
\cdbseealgo{substitute}