Syntax for term re-writing: (rule ) Pattern examples: (? a) (? a number?) (? a not-number?) (? a number? odd?) (? a (free? x)) (? a (neq? 0)) ; match zero or more into a list; expand list in-line, same order (?* l) Full examples: (rule (/ 1 (/ (? a) (? b))) (/ (? b) (? a))) Simplifications: - variable names must be single Latin letter - predicates are fixed to a set of type checks ## Implementation Separate rule lists, one for each "head" type (Sum, Product, Power, etc). struct RuleSet { sum_rules: Vec, product_rules: Vec, [...] } struct Rule { variables: HashMap>, pattern: MatchExpr, substitute: MatchExpr, } enum MatchExpr { variable: char, atom: CExpr, list: { head: expr_type, tail: Vec }, } ---------------- Backburner: - are additional pattern-wide predicates necessary or helpful?