Esempio n. 1
0
            public override object exec(Node <object> args)
            {
                Node <Object> list = args.First() as Node <Object>;

                list = ReverseFun.base_run(list);
                args = args.Rest();
                return(ReduceFun.base_run(list, args));
            }
Esempio n. 2
0
            public override object exec(Node <object> args)
            {
                Node <Object> list = args.First() as Node <Object>;

                args = args.Rest();
                int i = (int)args.First();

                Node <Object> r = null;

                while (i != 0)
                {
                    r = Node <Object> .extend(list.First(), r);

                    list = list.Rest();
                    i--;
                }
                return(ReverseFun.base_run(r));
            }
Esempio n. 3
0
        public static Node <Object> library()
        {
            Node <Object> m = null;

            m = Node <Object> .kvs_extend("true", true, m);

            m = Node <Object> .kvs_extend("false", false, m);

            m = Node <Object> .kvs_extend("first", FirstFun.instance(), m);

            m = Node <Object> .kvs_extend("rest", RestFun.instance(), m);

            m = Node <Object> .kvs_extend("extend", ExtendFun.instance(), m);

            m = Node <Object> .kvs_extend("length", LengthFun.instance(), m);

            m = Node <Object> .kvs_extend("+", AddFun.instance(), m);

            m = Node <Object> .kvs_extend("-", SubFun.instance(), m);

            m = Node <Object> .kvs_extend(">", MBiggerFun.instance(), m);

            m = Node <Object> .kvs_extend("<", MSmallerFun.instance(), m);

            m = Node <Object> .kvs_extend("=", MEqFun.instance(), m);

            m = Node <Object> .kvs_extend("and", AndFun.instance(), m);

            m = Node <Object> .kvs_extend("or", OrFun.instance(), m);

            m = Node <Object> .kvs_extend("not", NotFun.instance(), m);

            m = Node <Object> .kvs_extend("empty?", IsemptyFun.instance(), m);

            m = Node <Object> .kvs_extend("exist?", IsexistFun.instance(), m);

            m = Node <Object> .kvs_extend("log", LogFun.instance(), m);

            m = Node <Object> .kvs_extend("if", IfFun.instance(), m);

            m = Node <Object> .kvs_extend("eq", EqFun.instance(), m);

            m = Node <Object> .kvs_extend("apply", ApplyFun.instance(), m);

            m = Node <Object> .kvs_extend("stringify", StringifyFun.instance(), m);

            m = Node <Object> .kvs_extend("type", TypeFun.instance(), m);

            m = Node <Object> .kvs_extend("str-eq", Str_eqFun.instance(), m);

            m = Node <Object> .kvs_extend("str-length", Str_lengthFun.instance(), m);

            m = Node <Object> .kvs_extend("str-charAt", Str_charAtFun.instance(), m);

            m = Node <Object> .kvs_extend("str-substr", Str_substrFun.instance(), m);

            m = Node <Object> .kvs_extend("str-join", Str_joinFun.instance(), m);

            m = Node <Object> .kvs_extend("str-split", Str_splitFun.instance(), m);

            m = Node <Object> .kvs_extend("str-upper", Str_upperFun.instance(), m);

            m = Node <Object> .kvs_extend("str-lower", Str_lowerFun.instance(), m);

            m = Node <Object> .kvs_extend("quote", QuoteFun.instance(), m);

            m = Node <Object> .kvs_extend("list", ListFun.instance(), m);

            m = Node <Object> .kvs_extend("type?", IstypeFun.instance(), m);

            m = Node <Object> .kvs_extend("!=", MNotEqFun.instance(), m);

            m = Node <Object> .kvs_extend("reverse", ReverseFun.instance(), m);

            m = Node <Object> .kvs_extend("kvs-reverse", Kvs_reverseFun.instance(), m);

            m = Node <Object> .kvs_extend("empty-fun", Empty_funFun.instance(), m);

            m = Node <Object> .kvs_extend("default", DefaultFun.instance(), m);

            m = Node <Object> .kvs_extend("if-run", If_runFun.instance(), m);

            m = Node <Object> .kvs_extend("reduce", ReduceFun.instance(), m);

            m = Node <Object> .kvs_extend("reduce-right", Reduce_rightFun.instance(), m);

            m = Node <Object> .kvs_extend("kvs-reduce", Kvs_reduceFun.instance(), m);

            m = Node <Object> .kvs_extend("kvs-reduce-right", Kvs_reduce_rightFun.instance(), m);

            m = Node <Object> .kvs_extend("kvs-find1st", Kvs_find1stFun.instance(), m);

            m = Node <Object> .kvs_extend("kvs-extend", Kvs_extendFun.instance(), m);

            m = Node <Object> .kvs_extend("kvs-path", Kvs_pathFun.instance(), m);

            m = Node <Object> .kvs_extend("kvs-path-run", Kvs_path_runFun.instance(), m);

            m = Node <Object> .kvs_extend("offset", OffsetFun.instance(), m);

            m = Node <Object> .kvs_extend("slice-to", Slice_toFun.instance(), m);

            m = Node <Object> .kvs_extend("len", LenFun.instance(), m);

            return(m);
        }