Function dc_ock::eval

source · []
pub fn eval(input: &str, stack: &mut VecDeque<f64>)
Expand description

eval takes a &str and a &mut VecDeque<f64>, evaluates the expression, and prints the result, pushing the results onto the stack of type VecDeque provided as a parameter.

It does not return an error, but will instead silently fail if the expression is invalid. Additionally, it mutates the stack parameter, rather than returning a new one. Even if the stack is empty, it will still evaluate the expression. For this reason, eval is unsafe, and safe_eval or safe_eval_with_stack should be used.