Last active
January 5, 2017 10:16
-
-
Save Kerollmops/9f635cf707e53d05c5d86b63266d7f36 to your computer and use it in GitHub Desktop.
basic example float for the Medium article on Ripin-rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extern crate ripin; | |
| use ripin::operate::FloatExpression; | |
| let str_expr = "3 4 + 2 *"; | |
| let tokens = str_expr.split_whitespace(); | |
| let expr = FloatExpression::<f32>::from_iter(tokens).expect("Parsing error!"); | |
| assert_eq!(expr.evaluate(), Ok(14.0)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment