Crates.io | polishexpr |
lib.rs | polishexpr |
version | 0.1.4 |
source | src |
created_at | 2023-12-09 18:56:28.113733 |
updated_at | 2023-12-10 02:14:19.038247 |
description | A poorly implementation of a polish reverse expression evaluator |
homepage | https://github.com/jgardona/polishexpr |
repository | https://github.com/jgardona/polishexpr |
max_upload_size | |
id | 1063833 |
size | 10,339 |
A poorly implemented polish reverse expression evaluator.
The list of supported functions are:
Arguments for these functions could be as usual constants, written as numbers, as variables, written as $var_number ($0, for example). The variable number is zero based index of variables vector.
let pe = PolishEvaluator::new("$0 2 +", &[2.0]);
let result = pe.evaluate()?;
assert_eq!(4f64, result);
let pe = PolishEvaluator::new("$0 $1 + $3 -", &[2.0, 3.0, 5.0]);
let result = pe.evaluate()?;
assert_eq!(0f64, result);