• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Shelisp类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Fcapitalize

        public static Shelisp.Object Fcapitalize(L l, Shelisp.Object obj)
        {
            if (obj is Shelisp.String) {
                StringBuilder sb = new StringBuilder ((string)(Shelisp.String)obj);

                bool need_capitalization = true;
                for (int i = 0; i < sb.Length; i ++) {
                    if (Char.IsLetter (sb[i])) {
                        if (need_capitalization) {
                            sb[i] = Char.ToUpper(sb[i]);
                            need_capitalization = false;
                        }
                    }
                    else {
                        need_capitalization = true;
                    }

                }

                return (Shelisp.String)sb.ToString();
            }
            else {
                Console.WriteLine ("unimplemented non-string version of capitalize");
                return obj;
            }
        }
开发者ID:toshok,项目名称:shelisp,代码行数:26,代码来源:String.cs


示例2: Feql

        public static Shelisp.Object Feql(L l, Shelisp.Object o1, Shelisp.Object o2)
        {
            if (L.NILP(o1))
                return L.NILP(o2) ? L.Qt : L.Qnil;

            return o1.LispEql (o2) ? L.Qt : L.Qnil;
        }
开发者ID:toshok,项目名称:shelisp,代码行数:7,代码来源:Object.cs


示例3: Fprog1

 public static Shelisp.Object Fprog1(L l, Shelisp.Object form1, params Shelisp.Object[] forms)
 {
     Shelisp.Object rv = form1.Eval(l);
     for (int i = 0; i < forms.Length; i ++)
         forms[i].Eval(l);
     return rv;
 }
开发者ID:toshok,项目名称:shelisp,代码行数:7,代码来源:Control.cs


示例4: Eq

 public static AssertResult Eq(Shelisp.Object o1, Shelisp.Object o2, string description = null)
 {
     try {
         return (!o1.LispEq (o2)) ? Fail(description) : Succeed(description);
     }
     catch (Exception e) {
         return FailException (e, description);
     }
 }
开发者ID:toshok,项目名称:shelisp,代码行数:9,代码来源:Shunit.cs


示例5: Ffillarray

 public static Shelisp.Object Ffillarray(L l, Shelisp.Object arr, Shelisp.Object val)
 {
     // XXX type checks
     Array array = (Array)arr;
     for (int i = 0; i < array.Length; i ++) {
         array[i] = val;
     }
     return arr;
 }
开发者ID:toshok,项目名称:shelisp,代码行数:9,代码来源:Array.cs


示例6: Fmessage

        public static Shelisp.Object Fmessage(L l, Shelisp.Object format, params Shelisp.Object[] args)
        {
            var output = format;
            if (format is Shelisp.String) {
                output = Format.CFormat ((Shelisp.String)format, args);
            }

            Console.WriteLine (output.ToString("princ"));
            return output;
        }
开发者ID:toshok,项目名称:shelisp,代码行数:10,代码来源:IO.cs


示例7: Fautoload

        public static Shelisp.Object Fautoload(L l, Shelisp.Object function, [LispOptional] Shelisp.Object filename, Shelisp.Object docstring, Shelisp.Object interactive, Shelisp.Object type)
        {
            if (L.Qt.LispEq (Symbol.Ffboundp (l, function)))
                return L.Qnil;

            var autoload_function = new List (new Shelisp.Object[] { L.Qautoload, filename, docstring == null ? (Shelisp.Object)(Shelisp.String)"" : docstring, interactive == null ? L.Qnil : interactive, type == null ? L.Qnil : interactive });
            Symbol.Ffset (l, function, autoload_function);
            //l.Environment = new List (new List(function, function), l.Environment);
            return autoload_function;
        }
开发者ID:toshok,项目名称:shelisp,代码行数:10,代码来源:FileIO.cs


示例8: Fif

 public static Shelisp.Object Fif(L l, Shelisp.Object condition, Shelisp.Object then_form, params Shelisp.Object[] else_forms)
 {
     if (!L.NILP(condition.Eval(l))) {
         return then_form.Eval(l);
     }
     else {
         Shelisp.Object rv = L.Qnil;
         for (int i = 0; i < else_forms.Length; i ++)
             rv = else_forms[i].Eval(l);
         return rv;
     }
 }
开发者ID:toshok,项目名称:shelisp,代码行数:12,代码来源:Control.cs


示例9: Fread_from_minibuffer

        public static Shelisp.Object Fread_from_minibuffer(L l, Shelisp.Object prompt,
								    [LispOptional] Shelisp.Object initial_contents, Shelisp.Object keymap, Shelisp.Object read, Shelisp.Object hist, Shelisp.Object default_value, Shelisp.Object inherit_input_method)
        {
            Console.Write (prompt.ToString("princ"));
            var input = Console.ReadLine ();

            if (L.NILP (read))
                return (Shelisp.String)input;
            else {
                return Reader.ReadFromString (input);
            }
        }
开发者ID:toshok,项目名称:shelisp,代码行数:12,代码来源:Minibuffer.cs


示例10: Faset

 public static Shelisp.Object Faset(L l, Shelisp.Object sym, Shelisp.Object idx, Shelisp.Object val)
 {
     if (sym is Vector) {
         return ((Vector)sym)[(int)(Number)idx] = val;
     }
     else if (sym is Array) {
         return ((Array)sym)[(int)(Number)idx] = val;
     }
     else {
         throw new WrongTypeArgumentException ("array-or-vectorp", sym ?? L.Qnil);
     }
 }
开发者ID:toshok,项目名称:shelisp,代码行数:12,代码来源:Array.cs


示例11: Fdec

        public static Shelisp.Object Fdec(L l, Shelisp.Object op)
        {
            if (!(op is Number)) throw new WrongTypeArgumentException ("numberp", op);

            Number ln = (Number)op;

            bool need_float = ln.boxed is float;

            if (need_float) {
                return new Number ((float)ln.boxed - 1);
            }
            else
                return new Number ((int)ln.boxed - 1);
        }
开发者ID:toshok,项目名称:shelisp,代码行数:14,代码来源:Number.cs


示例12: Fread_from_string

        public static Shelisp.Object Fread_from_string(L l, Shelisp.Object str, [LispOptional] Shelisp.Object start, Shelisp.Object end)
        {
            #if false
            if (!(str is String))
                throw new WrongTypeArgumentException ("stringp", str);
            Shelisp.Object obj;
            int pos;

            obj = Reader.Read ((string)(Shelisp.String)str, out pos);

            return new List (obj, (Number)pos);
            #endif
            return L.Qnil;
        }
开发者ID:toshok,项目名称:shelisp,代码行数:14,代码来源:Reader.cs


示例13: Fset_marker_insertion_type

        public static Shelisp.Object Fset_marker_insertion_type(L l, Shelisp.Object marker, Shelisp.Object insertion_type)
        {
            if (!(marker is Marker))
                throw new WrongTypeArgumentException ("markerp", marker);

            Marker m = (Marker)marker;

            if (L.Qt.LispEq (insertion_type))
                m.Type = InsertionType.MarkerAdvancesOnTextInsertion;
            else if (L.Qnil.LispEq (insertion_type))
                m.Type = InsertionType.MarkerDoesNotAdvanceOnTextInsertion;
            else
                throw new Exception ();

            return L.Qnil;
        }
开发者ID:toshok,项目名称:shelisp,代码行数:16,代码来源:Marker.cs


示例14: Fplist_get

        public static Shelisp.Object Fplist_get(L l, Shelisp.Object plist, Shelisp.Object property)
        {
            Shelisp.Object el = plist;
            Shelisp.Object val = L.Qnil;

            while (!L.NILP (el)) {
                if (L.CAR(el).LispEq (property)) {
                    // the next thing in the list is the value
                    val = L.CAR(L.CDR(el));
                    break;
                }

                el = L.CDR (el);
            }

            return val;
        }
开发者ID:toshok,项目名称:shelisp,代码行数:17,代码来源:Plist.cs


示例15: Hash

        public Hash(L l, Shelisp.Object test, Shelisp.Object weakness, Shelisp.Object size, Shelisp.Object rehash_size, Shelisp.Object rehash_threshold)
        {
            this.l = l;
            this.test = test;
            this.weakness = weakness;
            this.size = size;
            this.rehash_size = size;
            this.rehash_threshold = rehash_threshold;

            this.count = 0;
            // map weakness to our enum
            if (L.NILP (weakness)) {
                weakness_ = Weakness.None;
            }
            else if (weakness.LispEq (L.Qt)) {
                weakness_ = Weakness.KeyAndValue;
            }
            else if (weakness.LispEq (L.Qkey)) {
                weakness_ = Weakness.Key;
            }
            else if (weakness.LispEq (L.Qvalue)) {
                weakness_ = Weakness.Value;
            }
            else if (weakness.LispEq (L.Qkey_or_value)) {
                weakness_ = Weakness.KeyOrValue;
            }
            else if (weakness.LispEq (L.Qkey_and_value)) {
                weakness_ = Weakness.KeyAndValue;
            }
            else
                throw new Exception (string.Format ("invalid weakness {0}", weakness));

            compare = null;
            // use a builtin comparison function for the builtin test types
            if (test.LispEq (L.intern ("eq"))) {
                compare = compare_eq;
            }
            else if (test.LispEq (L.intern ("eql"))) {
                compare = compare_eql;
            }
            else if (test.LispEqual (L.intern ("equal"))) {
                compare = compare_equal;
            }

            table = new Tuple<Shelisp.Object,Shelisp.Object>[(int)((Number)size).boxed];
        }
开发者ID:toshok,项目名称:shelisp,代码行数:46,代码来源:Hash.cs


示例16: Fformat_dotnet

 public static Shelisp.Object Fformat_dotnet(L l, Shelisp.Object format, params Shelisp.Object[] args)
 {
     switch (args.Length) {
     case 0: return new Shelisp.String (string.Format ((Shelisp.String)format));
     case 1: return new Shelisp.String (string.Format ((Shelisp.String)format, args[0]));
     case 2: return new Shelisp.String (string.Format ((Shelisp.String)format, args[0], args[1]));
     case 3: return new Shelisp.String (string.Format ((Shelisp.String)format, args[0], args[1], args[2]));
     case 4: return new Shelisp.String (string.Format ((Shelisp.String)format, args[0], args[1], args[2], args[3]));
     case 5: return new Shelisp.String (string.Format ((Shelisp.String)format, args[0], args[1], args[2], args[3], args[4]));
     case 6: return new Shelisp.String (string.Format ((Shelisp.String)format, args[0], args[1], args[2], args[3], args[4], args[5]));
     case 7: return new Shelisp.String (string.Format ((Shelisp.String)format, args[0], args[1], args[2], args[3], args[4], args[5], args[6]));
     case 8: return new Shelisp.String (string.Format ((Shelisp.String)format, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]));
     case 9: return new Shelisp.String (string.Format ((Shelisp.String)format, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]));
     case 10: return new Shelisp.String (string.Format ((Shelisp.String)format, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]));
     default:
         throw new Exception ();
     }
 }
开发者ID:toshok,项目名称:shelisp,代码行数:18,代码来源:IO.cs


示例17: Fadd

        public static Shelisp.Object Fadd(L l, Shelisp.Object op1, Shelisp.Object op2)
        {
            if (!(op1 is Number)) throw new WrongTypeArgumentException ("numberp", op1);
            if (!(op2 is Number)) throw new WrongTypeArgumentException ("numberp", op2);

            Number ln = (Number)op1;
            Number rn = (Number)op2;

            if (ln.boxed is float && rn.boxed is float) {
                return new Number ((float)ln.boxed + (float)rn.boxed);
            }
            else if (ln.boxed is float) {
                return new Number ((float)ln.boxed + (int)rn.boxed);
            }
            else if (rn.boxed is float) {
                return new Number ((int)ln.boxed + (float)rn.boxed);
            }
            else
                return new Number ((int)ln.boxed + (int)rn.boxed);
        }
开发者ID:toshok,项目名称:shelisp,代码行数:20,代码来源:Number.cs


示例18: DoAutoload

 public static Shelisp.Object DoAutoload(L l, Shelisp.Object fun, Shelisp.Object original_fun)
 {
     string filename = (string)(Shelisp.String)L.CAR (L.CDR (fun));
     if (L.NILP (l.Vload_path)) {
         Console.WriteLine ("load path = NIL!");
         return Fload_file (l, (Shelisp.String)(filename + ".el"));
     }
     else {
         foreach (var o in (List)l.Vload_path) {
             string full_path = Path.Combine ((string)(Shelisp.String)o, filename);
             if (Path.GetExtension (full_path) != ".el")
                 full_path = full_path + ".el";
             if (File.Exists (full_path)) {
                 Console.WriteLine ("found {0}", full_path);
                 return Fload_file (l, (Shelisp.String)full_path);
             }
             Console.WriteLine ("{0} not found", full_path);
         }
     }
     throw new Exception ("file not found");
 }
开发者ID:toshok,项目名称:shelisp,代码行数:21,代码来源:FileIO.cs


示例19: CFormat

 public static Shelisp.String CFormat(Shelisp.String format, params Shelisp.Object[] args)
 {
     int arg_num = 0;
     StringBuilder sb = new StringBuilder ();
     string format_s = (string)(Shelisp.String)format;
     for (int i = 0; i < format_s.Length; i ++) {
         if (format_s[i] == '%') {
             char specifier = format_s[++i];
             switch (specifier) {
             case '%':
                 sb.Append ('%');
                 break;
             case 'd':
                 sb.Append (Number.ToInt(args[arg_num++]));
                 break;
             case 's':
                 sb.Append (args[arg_num++].ToString("princ"));
                 break;
             case 'S':
                 sb.Append (args[arg_num++].ToString("prin1"));
                 break;
             case 'c':
                 if (!Number.IsInt (args[arg_num]))
                     throw new LispErrorException ("Format specifier doesn't match argument type");
                 sb.Append ((char)Number.ToInt(args[arg_num++]));
                 break;
             default:
                 throw new Exception (string.Format ("format {0} unsupported", specifier));
             }
         }
         else {
             sb.Append (format_s[i]);
         }
     }
     return (Shelisp.String)sb.ToString();
 }
开发者ID:toshok,项目名称:shelisp,代码行数:36,代码来源:Format.cs


示例20: RecordBuffer

		public static void RecordBuffer (Shelisp.Object buffer)
		{
			throw new NotImplementedException ();
		}
开发者ID:toshok,项目名称:shelisp,代码行数:4,代码来源:Buffer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Shell类代码示例发布时间:2022-05-24
下一篇:
C# Sheet类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap