public PushResult ( Datum d ) : |
||
d | Datum | |
Результат |
public override Continuation Evaluate(Continuation c, LexicalEnvironment env, Datum args) { return c.PushResult(evaluate(c, args)); }
public override Continuation Evaluate(Continuation c, Datum args) { return c.PushResult(function.Evaluate(args)); }
public override Continuation Evaluate(Continuation c, Environment env, Datum args) { return c.PushResult(env.ToAtom()); }
public override Continuation Evaluate(Continuation c, LexicalEnvironment env, Datum args) { var p = args as Pair; c = c.PushEnv(env).PushTask(new EvaluateExpansion(this, p)); // Optimization - if this macro has been expanded on this Datum before, // use the same expansion. // See "macro-cache-in-datum" unit test for a demonstration of why // we need to check against "this" also. if(p != null) { var cachedPair = p.Cache as Pair; if(cachedPair != null && ReferenceEquals(cachedPair.First, this)) return c.PushResult(cachedPair.Second); } c.Statistics.Expansions++; return argFunction.Evaluate(c, args); }
public override Continuation Evaluate(Continuation c, Datum args) { return(c.PushResult(function.Evaluate(args))); }
public override Continuation Evaluate(Continuation c, Environment env, Datum args) { var datumArgs = args.ToArray(); if (datumArgs.Length != 1) throw c.error("Ref expect 1s arguments. {0} passed", datumArgs.Length); var assemblyName = datumArgs[0].CastIdentifier(); var assembly = Assembly.Load(assemblyName); // Keep a hash set to avoid adding things twice. // Overload resolution is (hopefully) handled by // InvokeMethod. var symbols = new HashSet<object>(); // Add all static methods foreach (var t in assembly.GetTypes()) { // Make each type have a symbol in the environment also. env.Define(t.FullName, t.ToAtom()); foreach (var mi in t.GetMethods()) { var symbol = string.Format("{0}.{1}", t.FullName, mi.Name); if (mi.IsStatic && symbols.Add(symbol)) env.Define(symbol, new StaticMethod(t, mi.Name).ToStack()); } } return c.PushResult(DatumHelpers.nil); }