예제 #1
0
        public Value Visit(Expr.Application app)
        {
            Value fn = InterpreterVisitor.Interpret(_env, app.Fn);

            if (fn.Type() != TypeName.Lambda)
            {
                throw new ErrorBuilder().Msg($"expected a lambda, found a {fn.Type().Display()}").Type(ErrorType.Type)
                      .Span(app.Fn.Span).Build();
            }


            Value.VLambda lam = (Value.VLambda)fn;
            return(lam.Lam(new Thunk(() =>
            {
                Value val = InterpreterVisitor.Interpret(_env, app.Arg);
                val.Span = app.Span;
                return val;
            })));
        }
예제 #2
0
 public string visit(Value.VLambda lam)
 {
     return("<lambda>");
 }