Esempio n. 1
0
        public override SucoExpression Optimize(SucoEnvironment env, int?[] givens)
        {
            var valueExpr = ValueExpression.Optimize(env, givens);
            var innerExpr = InnerExpression.Optimize(env.DeclareVariable(VariableName, valueExpr is SucoConstant c ? c.Value : null), givens);

            return(innerExpr is SucoConstant ? innerExpr : new SucoLetExpression(StartIndex, EndIndex, VariableName, valueExpr, innerExpr, Type));
        }
Esempio n. 2
0
 public override object Interpret(SucoEnvironment env, int?[] grid) => InnerExpression.Interpret(env.DeclareVariable(VariableName, ValueExpression.Interpret(env, grid)), grid);