Bring the whole workspace into compliance with the repo's rustfmt config (edition 2024, max_width 100, use_small_heuristics = "Max"), which had drifted across many crates. Pure formatting — no logic changes; `cargo fmt --check` is now clean and `cargo build --workspace` is green.
12 lines
424 B
Rust
12 lines
424 B
Rust
use lawsynth_core::Identifier;
|
|
use lawsynth_expr::{Environment, evaluate, parse, print};
|
|
|
|
fn main() {
|
|
let expression = parse("2 * x + sin(y)").expect("valid expression");
|
|
let values = Environment::from([
|
|
(Identifier::new("x").unwrap(), 3.0),
|
|
(Identifier::new("y").unwrap(), std::f64::consts::FRAC_PI_2),
|
|
]);
|
|
println!("{} = {}", print(&expression), evaluate(&expression, &values).unwrap());
|
|
}
|