當前位置: 首頁>>代碼示例>>C#>>正文


C# Environment.Bind方法代碼示例

本文整理匯總了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;
                        }
開發者ID:jleen,項目名稱:sharpf,代碼行數:67,代碼來源:eval.cs


注:本文中的System.Environment.Bind方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。