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


C# Datum类代码示例

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


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

示例1: 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

示例2: 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

示例3: eval

 protected override Datum eval(Datum arg1, Datum arg2)
 {
     if ((arg1 as Pair) != null ||
         (arg2 as Pair) != null)
         return DatumHelpers.atom(ReferenceEquals(arg1, arg2));
     return DatumHelpers.atom(arg1.Equals(arg2));
 }
开发者ID:1tgr,项目名称:FirstClassLisp,代码行数:7,代码来源:Eq.cs

示例4: car

 public static Datum car(Datum d)
 {
     var pair = d as Pair;
     if (pair == null)
         throw error("'{0}' is not a pair", d);
     return pair.First;
 }
开发者ID:1tgr,项目名称:FirstClassLisp,代码行数:7,代码来源:DatumHelpers.cs

示例5: Evaluate

 public override Continuation Evaluate(Continuation c, LexicalEnvironment env, Datum args)
 {
     var argArray = DatumHelpers.enumerate(args).ToArray();
     Array.Reverse(argArray);
     c = c.PushTask(new InvokeFunction(function, argArray.Length));
     return argArray.Aggregate(c, (current, arg) => current.Evaluate(env, arg));
 }
开发者ID:Patient0,项目名称:FirstClassLisp,代码行数:7,代码来源:FunctionExpression.cs

示例6: asContinuation

 private static Continuation asContinuation(Datum arg)
 {
     var cfunction = arg as CallCC.ContinuationFunction;
     if (cfunction == null)
         throw DatumHelpers.error("'{0}' is not a continuation", arg);
     return cfunction.Continuation;
 }
开发者ID:Patient0,项目名称:FirstClassLisp,代码行数:7,代码来源:DebugFunctions.cs

示例7: 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

示例8: 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

示例9: 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

示例10: castObject

 public static object castObject(Datum d)
 {
     var a = d as Atom;
     if (a == null)
         throw error("Expected '{0}' to be an atom, but got '{1}' instead", d, d.GetType().Name);
     return a.Value;
 }
开发者ID:1tgr,项目名称:FirstClassLisp,代码行数:7,代码来源:DatumHelpers.cs

示例11: Write

        public override void Write(Datum aggregatedDatum)
        {
            if (!App.Available) return;

               if (UseLog)
             base.Write(aggregatedDatum);

               var node = ReceiverNode;

               if (node.IsNullOrWhiteSpace()) return;

               string site;
               if (SiteName.IsNotNullOrWhiteSpace())
             site = SiteName;
               else
             site = "{0}::{1}@{2}".Args(App.Name, App.InstanceID, System.Environment.MachineName);

               try
               {
               if (m_Client==null)
                   m_Client = new TelemetryReceiverClient(ReceiverNode);

               m_Client.Send(site, aggregatedDatum);
               }
               catch(Exception error)
               {
               cleanupClient();
               WriteLog(MessageType.Error, error.ToMessageWithType(), from: "{0}.{1}".Args(GetType().Name, "Write(datum)") );
               }
        }
开发者ID:itadapter,项目名称:nfx,代码行数:30,代码来源:TelemetryInstrumentationProvider.cs

示例12: 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

示例13: Evaluate

 public Datum Evaluate(Datum args)
 {
     var function = UnaryFunction.GetSingle(args) as StackFunction;
     if (function == null)
         throw error("Expected function argument");
     return ToMacro(function);
 }
开发者ID:Patient0,项目名称:FirstClassLisp,代码行数:7,代码来源:Macro.cs

示例14: 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

示例15: buildSymbolForm

 // Create a "special form" for a symbol that has either "." or "/" inside it.
 private static Datum buildSymbolForm(Datum name, IEnumerable<string> contents)
 {
     // "prefix" with a 'dot' so that higher level macros can interpret it.
     // This means you can't have normal symbols containing dots, which is a
     // small price to pay IMO.
     var args = compound(contents.Select(c => c == "" ? nil : parseSymbol(c)).ToArray());
     return cons(name, args);
 }
开发者ID:Patient0,项目名称:FirstClassLisp,代码行数:9,代码来源:Parser.cs


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