From f22e916e0c0a19d38d627a838fa9bcff32f45141 Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Sat, 26 Sep 2026 13:25:05 +0100 Subject: [PATCH] Use differentiation pipeline in demo --- src/bin/demo.rs | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/bin/demo.rs b/src/bin/demo.rs index cddce1d..4e44226 100644 --- a/src/bin/demo.rs +++ b/src/bin/demo.rs @@ -1,20 +1,12 @@ -use deriv::Expression; -use deriv::Evaluator; use deriv::Repl; - -struct DummyEvaluator; - -impl Evaluator for DummyEvaluator { - type Expr = Expression; - type Error = std::io::Error; - - fn eval(&mut self, input: Self::Expr) -> Result { - Ok(input) - } -} +use deriv::eval; fn main() -> std::io::Result<()> { - let mut repl = Repl::new( - std::io::stdin(), std::io::stdout(), DummyEvaluator {}); + let eval = deriv::pipeline!( + eval::Normaliser::new(), + eval::Differentiator::new('x'), + eval::ConstFolder::new(), + eval::Simplifier::new()); + let mut repl = Repl::new(std::io::stdin(), std::io::stdout(), eval); repl.run() }