当前位置: 首页>>代码示例>>C#>>正文


C# Datum.ToArray方法代码示例

本文整理汇总了C#中Datum.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# Datum.ToArray方法的具体用法?C# Datum.ToArray怎么用?C# Datum.ToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Datum的用法示例。


在下文中一共展示了Datum.ToArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Evaluate

 public override Continuation Evaluate(Continuation s, Datum args)
 {
     var argArray = args.ToArray();
     var expression = argArray[0];
     var environment = (Environment) argArray[1].CastObject();
     return s.Evaluate(environment, expression);
 }
开发者ID:1tgr,项目名称:FirstClassLisp,代码行数:7,代码来源:Eval.cs

示例2: Evaluate

 public override Continuation Evaluate(Continuation oldContinuation, Datum args)
 {
     // Replace the old continuation with the new continuation - but pass in the
     // supplied argument as the 'return value' of the new continuation.
     var returnValue = args.ToArray()[0];
     return c.PushResult(returnValue);
 }
开发者ID:1tgr,项目名称:FirstClassLisp,代码行数:7,代码来源:CallCC.cs

示例3: Evaluate

 public Datum Evaluate(Datum args)
 {
     var argArray = args.ToArray();
     var names = argArray.Select(x => x.CastString()).ToArray();
     var fullname = string.Join(".", names);
     return GetTypeEx(fullname).ToAtom();
 }
开发者ID:Patient0,项目名称:FirstClassLisp,代码行数:7,代码来源:ReflectionBuiltins.cs

示例4: evaluate

 private static Datum evaluate(Continuation c, Datum args)
 {
     var argList = args.ToArray();
     if (argList.Length != 1)
         throw c.error("invalid syntax '{0}'", args);
     return argList[0];
 }
开发者ID:Patient0,项目名称:FirstClassLisp,代码行数:7,代码来源:Quote.cs

示例5: Evaluate

 public Datum Evaluate(Datum args)
 {
     var argArray = args.ToArray();
     if (argArray.Length != 1)
         throw DatumHelpers.error("Expected a single argument. Got {0}", argArray.Length);
     return eval(argArray[0]);
 }
开发者ID:1tgr,项目名称:FirstClassLisp,代码行数:7,代码来源:UnaryFunction.cs

示例6: Evaluate

 public Datum Evaluate(Datum args)
 {
     var argDatums = args.ToArray();
     if (argDatums.Length != 2)
         throw DatumHelpers.error("Exactly 2 arguments expected");
     return eval(argDatums[0], argDatums[1]);
 }
开发者ID:Patient0,项目名称:FirstClassLisp,代码行数:7,代码来源:BinaryFunction.cs

示例7: GetSingle

 public static Datum GetSingle(Datum args)
 {
     var argArray = args.ToArray();
     if (argArray.Length != 1)
         throw DatumHelpers.error("Expected a single argument. Got {0}", argArray.Length);
     return argArray[0];
 }
开发者ID:Patient0,项目名称:FirstClassLisp,代码行数:7,代码来源:UnaryFunction.cs

示例8: Evaluate

 public override Continuation Evaluate(Continuation c, Datum args)
 {
     var argArray = args.ToArray();
     if (argArray.Length != 2)
         throw DatumHelpers.error("Invalid syntax. ArgCount ({0}) != 2. Usage: (execute-with-error-handler <error-function> <fn>)", argArray.Length);
     var errorHandler = makeErrorHandler(c.ErrorHandler, (StackFunction)argArray[0]);
     var fn = (StackFunction)argArray[1];
     return fn.Evaluate(c.NewErrorHandler(errorHandler), DatumHelpers.compound());
 }
开发者ID:Patient0,项目名称:FirstClassLisp,代码行数:9,代码来源:ExecuteWithErrorTranslator.cs

示例9: Evaluate

            public Datum Evaluate(Datum args)
            {
                var argArray = args.ToArray();

                var target = unwrapDatum(argArray[0]);
                var methodArgs = unwrap(args.Enumerate().Skip(1));
                var result = target.GetType().InvokeMember(name, BindingFlags.Default | BindingFlags.InvokeMethod, null, target, methodArgs);
                return result.ToAtom();
            }
开发者ID:1tgr,项目名称:FirstClassLisp,代码行数:9,代码来源:ReflectionBuiltins.cs

示例10: Evaluate

 public override Continuation Evaluate(Continuation c, Environment env, Datum args)
 {
     var argList = args.ToArray();
     if (argList.Length != 2)
         throw c.error("Expected 2 arguments: (set! <symbol> <expression>). Got {0} instead", argList.Length);
     var name = argList[0].CastIdentifier();
     var expression = argList[1];
     c = c.PushTask(new SetName(env, name));
     return c.Evaluate(env, expression);
 }
开发者ID:1tgr,项目名称:FirstClassLisp,代码行数:10,代码来源:Set.cs

示例11: Evaluate

 public override Continuation Evaluate(Continuation c, Datum args)
 {
     var datumArgs = args.ToArray();
     if (datumArgs.Length != 2)
         throw c.error("Apply expects 2 arguments. {0} passed", datumArgs.Length);
     var function = datumArgs[0] as StackFunction;
     if (function == null)
         throw c.error("'{0}' is not a function", datumArgs[0]);
     return function.Evaluate(c, datumArgs[1]);
 }
开发者ID:Patient0,项目名称:FirstClassLisp,代码行数:10,代码来源:Apply.cs

示例12: Evaluate

 public Datum Evaluate(Datum args)
 {
     var a = args.ToArray();
     if (a.Length != 1)
         // TODO: Move this error boiler plate into DatumHelpers
         throw error("Incorrect arguments. Expected {0}, got {1}", 1, a.Length);
     var function = a[0] as StackFunction;
     if (function == null)
         throw error("Expected function argument");
     return ToMacro(function);
 }
开发者ID:1tgr,项目名称:FirstClassLisp,代码行数:11,代码来源:Macro.cs

示例13: Evaluate

 public override Continuation Evaluate(Continuation oldContinuation, Datum args)
 {
     // Replace the old continuation with the new continuation - but pass in the
     // supplied argument as the 'return value' of the new continuation.
     var argArray = args.ToArray();
     // We allow calling a "continuation" with 0 args. Such a continuation
     // only arises from the error function.
     // TODO: we should differentiate the two with an "expected args" member which we can error check.
     if (argArray.Length == 0)
         return c;
     return c.PushResult(argArray[0]);
 }
开发者ID:Patient0,项目名称:FirstClassLisp,代码行数:12,代码来源:CallCC.cs

示例14: Evaluate

 public override Continuation Evaluate(Continuation c, LexicalEnvironment env, Datum args)
 {
     var argList = args.ToArray();
     if (argList.Length != 2)
         throw c.error("Expected 2 arguments: (define <symbol> <expression>). Got {0} instead", argList.Length);
     var name = argList[0].CastSymbol();
     var expression = argList[1];
     c = c.PushTask(
         tc => { env.Define(name, tc.Result);
                 return tc;},
         "define '{0}'", name);
     return c.Evaluate(env, expression);
 }
开发者ID:Patient0,项目名称:FirstClassLisp,代码行数:13,代码来源:Define.cs

示例15: evaluate

        private static Datum evaluate(Continuation c, Environment env, Datum args)
        {
            var macroArgs = args.ToArray();
            if (macroArgs.Length % 2 != 0)
                throw c.error("Invalid macro syntax for lambda. Argument count for '{0}' is not even ({1}). Syntax is (lambda [args body]+)", args, macroArgs.Length);

            var argBodies = new List<ArgBody>();
            for (var i = 0; i < macroArgs.Length; i += 2)
            {
                var closureArgs = macroArgs[i];
                var body = macroArgs[i + 1];
                argBodies.Add(new ArgBody(closureArgs, body));
            }
            return new Closure(env, argBodies);
        }
开发者ID:1tgr,项目名称:FirstClassLisp,代码行数:15,代码来源:Lambda.cs


注:本文中的Datum.ToArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。