I know why you blame me

This commit is contained in:
Rendo 2025-11-06 00:31:15 +05:00
commit ce95eb2516
3 changed files with 16 additions and 2 deletions

View file

@ -3,7 +3,7 @@ use crate::formula::node::Node;
pub mod node;
pub struct Formula {
root: node::Node,
root: node::Node<F>,
}
impl Formula {

View file

@ -0,0 +1,3 @@
pub trait Function {
fn map(x: f64) -> f64;
}

View file

@ -1,16 +1,27 @@
use crate::formula::node::graph_constructor::GraphBuilder;
mod function;
mod graph_constructor;
pub struct Node {
children: Vec<Node>,
function: fn(Vec<f64>) -> f64,
}
impl Node {
pub fn empty() -> Self {
Node { children: vec![] }
Node {
children: vec![],
function: |_| 0f64,
}
}
pub fn build() -> GraphBuilder {
GraphBuilder
}
pub fn get_value(&self) -> f64 {
if self.children.len() == 0 {
0f64
}
for node in self.children {}
}
}