Module pattern

Module pattern 

Source
Expand description

Pattern matching and substitution system for MathHook

This module provides the fundamental pattern matching and substitution capabilities that enable equation solving, transformation rules, and algebraic manipulation.

§Core Functionality

  1. Basic Substitution: Replace variables or subexpressions with values
  2. Multiple Substitution: Apply several substitutions simultaneously
  3. Pattern Matching: Match structural patterns with wildcards
  4. Pattern Replacement: Apply transformation rules

§Examples

use mathhook_core::prelude::*;
use mathhook_core::pattern::Substitutable;

let x = symbol!(x);
let expr = expr!(x + 1);

// Basic substitution: replace x with 5
let result = expr.subs(&Expression::symbol(x), &Expression::integer(5));
assert_eq!(result, Expression::integer(6));

Re-exports§

pub use matching::Matchable;
pub use matching::Pattern;
pub use matching::PatternMatches;
pub use substitution::Substitutable;

Modules§

matching
Pattern matching infrastructure for structural matching
substitution
Substitution system for replacing expressions