#rpn #polish #reverse #reverse-polish-notation #natation

rpn_lib

RPN(Reverse Polish Natation) library

7 releases

0.1.6 Nov 29, 2022
0.1.5 Nov 21, 2022
0.1.4 May 20, 2022

#7 in #polish

MIT license

4KB
50 lines

RPN(Reverse Polish Notation) Calc

Reverse Polish Notation (RPN) Calc.

Installation

cargo add rpn_lib

Example

fn main() {
    let src = String::from("1 2 + 3 * ");
    let a = rpn_lib::eval(src).unwrap();
    println!("{}", a); // →9
}

Example2

fn main() {
    let result = rpn_lib::eval_from_str("1 2 3 * +");
    println!("{}", result); // →7
}

No runtime deps