BUILT-IN WOLFRAM LANGUAGE SYMBOL
is equivalent to expr for pattern matching, but maintains expr in an unevaluated form.
- HoldPattern has attribute HoldAll.
- The left‐hand sides of rules are usually evaluated, as are parts of the left‐hand sides of assignments. You can use HoldPattern to stop any part from being evaluated.
Set up a pattern whose left-hand side is kept unevaluated:
Use the pattern:
Make a definition without the argument of being evaluated:
Log[a,b] autoevaluates to Log[b]/Log[a], so there is a match:
Cases[e,patt->rhs] finds elements that match patt; use HoldPattern to find rules: