diff --git a/src/ast/mod.rs b/src/ast/mod.rs index e0c6040..dfc8521 100644 --- a/src/ast/mod.rs +++ b/src/ast/mod.rs @@ -701,7 +701,7 @@ impl<'a> From<&'a PositionedItem> for PositionedItem { /// Encodes a func expression in the UCG AST.. /// -/// A func is a pure function over a tuple. +/// A func is a pure function over a expression. #[derive(PartialEq, Debug, Clone)] pub struct FuncDef { pub scope: Option, @@ -710,6 +710,16 @@ pub struct FuncDef { pub pos: Position, } +impl FuncDef { + fn derive_shape(&self) -> Shape { + // 1. First set up our symbols. + let _table = self.argdefs.iter().map(|sym| (sym.val.clone(), Shape::Hole(sym.clone()))).collect::>(); + // 2.Then determine the shapes of those symbols in our expression. + // 3. Finally determine what the return shape can be. + todo!(); + } +} + /// Specifies the types of binary operations supported in /// UCG expression. #[derive(Debug, PartialEq, Clone)] @@ -1003,7 +1013,7 @@ impl Expression { Expression::Copy(def) => derive_copy_shape(def, symbol_table), Expression::Include(def) => derive_include_shape(def), Expression::Call(_) => todo!(), - Expression::Func(_) => todo!(), + Expression::Func(def) => def.derive_shape(), Expression::Select(_) => todo!(), Expression::FuncOp(_) => todo!(), Expression::Module(_) => todo!(),