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


C# Shelisp类代码示例

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


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


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