本文整理汇总了C#中System.Environment.Bind方法的典型用法代码示例。如果您正苦于以下问题:C# Environment.Bind方法的具体用法?C# Environment.Bind怎么用?C# Environment.Bind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Environment
的用法示例。
在下文中一共展示了Environment.Bind方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Act
//.........这里部分代码省略.........
// Apply a continuation. Delightfully simple.
Continuation cont = func as Continuation;
if (cont != null)
{
Shell.TraceAction(
"Invoking continuation which will",
cont.call);
call.target = Actor.Continue;
call.arg = args[0];
// We cheerfully blow away the existing value
// of call.next, because this is a Scheme goto.
// This is the place where we "break the
// chain".
call.next = cont.call;
goto NextCall;
}
// Apply a closure. If you've read the wizard
// book, you can recite the mantra in your sleep:
// extend the defining environment, bind the params
// to the formals in the new environment, then
// evaluate the body in the new environment...
Closure closure = func as Closure;
if (closure != null)
{
Environment new_env = new Environment(closure.env);
Pair paramlist = closure.formals;
foreach (Datum arg in args)
{
new_env.Bind((Symbol)paramlist.car, arg);
paramlist = (Pair)paramlist.cdr;
}
call.target = Actor.EvalSequence;
call.arg = closure.body;
call.env = new_env;
goto NextCall;
}
// Well, if we're still here, it means some jerk
// has asked us to apply a non-function.
throw new InapplicableException(func);
}
// Continue evaluating an IF. We end up here after
// evaluating the test. We branch to the appropriate
// result clause.
case Actor.ExecuteIf:
{
Pair p = (Pair)call.arg;
Datum conseq = p.car;
Datum alts = p.cdr;
if (!Datum.IsTrue(call.Result))
{
call.target =
Actor.EvalSequence;
call.arg = alts;
goto NextCall;
}