use brotli::CompressorWriter; use symbolica::{ atom::Atom, id::Pattern, streaming::{TermStreamer, TermStreamerConfig}, }; fn main() { let input = Atom::parse("x+ f(x) + 2*f(y) + 7*f(z)").unwrap(); let pattern = Pattern::parse("f(x_)").unwrap(); let rhs = Pattern::parse("f(x) + x").unwrap().into(); let mut stream = TermStreamer::>::new(TermStreamerConfig { n_cores: 4, path: ".".to_owned(), max_mem_bytes: 40, }); stream.push(input); // map every term in the expression stream = stream.map(|x| pattern.replace_all(x.as_view(), &rhs, None, None).expand()); let res = stream.to_expression(); println!("\t+ {}", res); }