finished beeing able to use function as function in rust
This commit is contained in:
parent
19582a06ab
commit
fc6f2c8ebe
@ -1,5 +1,4 @@
|
||||
use std::env;
|
||||
use meval::tokenizer::tokenize;
|
||||
|
||||
fn main() {
|
||||
let args: Vec<String> = env::args().skip(1).take(3).collect();
|
||||
@ -23,7 +22,6 @@ fn main() {
|
||||
#[cfg(debug_assertions)]
|
||||
default_points(&mut points);
|
||||
|
||||
|
||||
group_by_x(&mut points);
|
||||
|
||||
let m1 = (points[0][1] - points[1][1]) / (points[0][0] - points[1][0]);
|
||||
@ -36,8 +34,11 @@ fn main() {
|
||||
if function.contains("NaN") {
|
||||
panic!("Contains NaN, this is probably the result of bad math");
|
||||
}
|
||||
let expr2 = tokenize(function.as_str()).unwrap();
|
||||
println!("{:?}", expr2);
|
||||
// let expr2 = tokenize(function.as_str()).unwrap();
|
||||
// println!("{:?}", expr2);
|
||||
let rust_function = function.parse::<meval::Expr>().unwrap().bind("x").unwrap();
|
||||
let result = rust_function(9.0);
|
||||
println!("{}", result);
|
||||
}
|
||||
|
||||
fn default_points(points: &mut [[f64;2];3]) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user