本文整理匯總了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;
}