Cdr() public static method

public static Cdr ( object arg ) : Object
arg object
return Object
Beispiel #1
0
        public static object CompileQuasiQuote(int level, object arg, Environment environment)
        {
            if (level == 0)
            {
                return(Compile1(arg, environment));
            }

            if (arg is ISequence)
            {
                ISequence c = (ISequence)arg;
                if (c.First() == UNQUOTE)
                {
                    return(new Pair(UNQUOTE, new Pair(CompileQuasiQuote(level - 1, Runtime.Car(Runtime.Cdr(arg)), environment))));
                }

                if ((level == 1) && (c.First() == UNQUOTE_SPLICING))
                {
                    return(new Pair(UNQUOTE_SPLICING, new Pair(CompileQuasiQuote(level - 1, Runtime.Car(Runtime.Cdr(arg)), environment))));
                }

                if (c.First() == QUASIQUOTE)
                {
                    return(new Pair(QUASIQUOTE, new Pair(CompileQuasiQuote(level + 1, Runtime.Car(Runtime.Cdr(arg)), environment))));
                }

                Pair r = null;
                foreach (object o in c)
                {
                    r = new Pair(CompileQuasiQuote(level, o, environment), r);
                }

                return(r.Reverse());
            }

            return(arg);
        }