-
-
Notifications
You must be signed in to change notification settings - Fork 88
Pattern matching
Axel Kramer edited this page Feb 16, 2023
·
2 revisions
If you want to manipulate IExpr
objects in Symja the dedicated design pattern is the visitor.
The visitor pattern is implemented in this package:
To simplify the manipulation of IExpr
objects a pattern matching mechanism has been designed in the Matcher
and Tester classes.
import static org.matheclipse.core.expression.F.*;
import org.matheclipse.core.patternmatching.Matcher;
Matcher matcher = new Matcher();
matcher.caseOf(Sin(x_), D(Sin(x), x));
// print Cos(y)
System.out.println(matcher.apply(Sin(y)));