Expr functions now act as closures

This commit is contained in:
2024-05-30 07:13:26 +02:00
parent d84e690ef3
commit f41ea96d17
4 changed files with 29 additions and 16 deletions
+1 -5
View File
@@ -108,11 +108,7 @@ func evalFuncDef(ctx ExprContext, self *term) (v any, err error) {
for _, param := range self.children {
paramList = append(paramList, param.source())
}
v = newExprFunctor(expr, paramList)
// v = &funcDefFunctor{
// params: paramList,
// expr: expr,
// }
v = newExprFunctor(expr, paramList, ctx)
} else {
err = errors.New("invalid function definition: the body specification must be an expression")
}