public static Lambda CompileFunction(FunctionDefinition function) { List <Variable> specialMappedTypes = GetSpecialMappedVariables(); IEnumerable <NameExpression> freeVars = function .Walk() .ToList() .MatchWith(specialMappedTypes); if (freeVars.Count() > 0) { // TODO throw new NotImplementedException("Compiling functions with free variables"); } // Binding is needed for the function to know what sort of a stack size // is needed by the body, but isn't needed for our purposes here function.Bind(new Binder()); GlobalContext context = new GlobalContext(); InternalLambda functionLambda = new InternalLambda { closures = new Closure[0], description = function.CompileInner(), context = context }; // TODO: does the context need the function itself? return(functionLambda); }