public static bool Divide(out object answer, object left, object right)
        {
            if (left is Bignum) {
                if (right is int) {
                    Bignum remainder;
                    Bignum q = Bignum.DivRem ((Bignum) left, (Bignum) (long) (int) right, out remainder);
                    answer = new Cons (Bignum.ToInteger (q), Bignum.ToInteger (remainder));
                    return false;
                }
                else if (right is long) {
                    Bignum remainder;
                    Bignum q = Bignum.DivRem ((Bignum) left, (Bignum) (long) right, out remainder);
                    answer = new Cons (Bignum.ToInteger (q), Bignum.ToInteger (remainder));
                    return false;
                }
                if (right is Bignum) {
                    Bignum remainder;
                    Bignum q = Bignum.DivRem ((Bignum) left, (Bignum) right, out remainder);
                    answer = new Cons (Bignum.ToInteger (q), Bignum.ToInteger (remainder));
                    return false;
                }
                else
                    throw new NotImplementedException ("Divide bignum by non-bignum.");
            }
            else {
                long w0 = Widen (left);
                long w1 = Widen (right);
                long remainder = 0;
                long quotient = Math.DivRem (w0, w1, out remainder);

                answer = new Cons (Narrow (quotient), Narrow (remainder));
                return false;
            }
        }
Example #2
0
 public static bool SubvectorToList(out object answer, object avec, object astart, object aend)
 {
     object [] vector = (object []) avec;
     int start = (int) astart;
     int end = (int) aend;
     Cons list = null;
     while (start < end) {
         list = new Cons (vector [--end], list);
     }
     answer = list;
     return false;
 }
Example #3
0
 Symbol(string name, bool intern)
 {
     if (name == null) throw new ArgumentNullException ("name");
     if (intern) {
         this.name = String.Intern (name);
         symbolTable.Add (this.name, this);
         obarray [0] = new Cons (this, obarray [0]);
     }
     else {
         this.name = name;
     }
     this.hashCode = name.GetHashCode ();
 }
Example #4
0
        public static bool SubvectorToList(out object answer, object avec, object astart, object aend)
        {
            object [] vector = (object [])avec;
            int       start  = (int)astart;
            int       end    = (int)aend;
            Cons      list   = null;

            while (start < end)
            {
                list = new Cons(vector [--end], list);
            }
            answer = list;
            return(false);
        }
Example #5
0
        public static bool UserApply(out object answer, object arg0, object arg1)
        {
            ////Primitive.Noisy = true;
            IApplicable op    = arg0 as IApplicable;
            Cons        rands = arg1 as Cons;

            if (op == null)
            {
                throw new NotImplementedException("Apply non applicable.");
            }
            if (arg1 != null && rands == null)
            {
                throw new NotImplementedException("Bad list to apply.");
            }
            answer = new TailCallInterpreter(new ApplyFromPrimitive(op, rands), null);
            return(true); // special return
        }
Example #6
0
        public static bool GeneralCarCdr(out object answer, object arg0, object arg1)
        {
            object result  = arg0;
            int    pattern = (int)arg1;

            while (pattern > 1)
            {
                Cons pair = result as Cons;
                if (pair == null)
                {
                    throw new NotImplementedException();
                }
                result    = ((pattern & 0x01) == 0x01) ? pair.Car : pair.Cdr;
                pattern >>= 1;
            }
            answer = result;
            return(false);
        }
Example #7
0
 Symbol(string name, bool intern)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     if (intern)
     {
         this.name = String.Intern(name);
         symbolTable.Add(this.name, this);
         obarray [0] = new Cons(this, obarray [0]);
     }
     else
     {
         this.name = name;
     }
     this.hashCode = name.GetHashCode();
 }
Example #8
0
        public static bool SystemSubvectorToList(out object answer, object arg, object start, object end)
        {
            ISystemVector sysVec = arg as ISystemVector;

            if (sysVec != null)
            {
                Cons result = null;
                for (int i = (int)end - 1; i > ((int)start - 1); i--)
                {
                    result = new Cons(sysVec.SystemVectorRef(i), result);
                }
                answer = result;
                return(false);
            }
            else
            {
                throw new NotImplementedException();
            }
        }
        public override bool EvalStep(out object answer, ref Control expression, ref Environment environment)
        {
#if DEBUG
            Warm("PrimitiveGeneralCarCdrLQ.EvalStep");
#endif
            // Eval argument0
            object ev0;
            if (environment.FastLexicalRef(out ev0, this.rand0Name, this.rand0Depth, this.rand0Offset))
            {
                throw new NotImplementedException();
            }

            // Compute answer
            if (Cons.GeneralCarCdr(out answer, ev0, this.rand1Value))
            {
                throw new NotImplementedException();
            }
            return(false);
        }
        public static bool Divide(out object answer, object left, object right)
        {
            if (left is Bignum)
            {
                if (right is int)
                {
                    Bignum remainder;
                    Bignum q = Bignum.DivRem((Bignum)left, (Bignum)(long)(int)right, out remainder);
                    answer = new Cons(Bignum.ToInteger(q), Bignum.ToInteger(remainder));
                    return(false);
                }
                else if (right is long)
                {
                    Bignum remainder;
                    Bignum q = Bignum.DivRem((Bignum)left, (Bignum)(long)right, out remainder);
                    answer = new Cons(Bignum.ToInteger(q), Bignum.ToInteger(remainder));
                    return(false);
                }
                if (right is Bignum)
                {
                    Bignum remainder;
                    Bignum q = Bignum.DivRem((Bignum)left, (Bignum)right, out remainder);
                    answer = new Cons(Bignum.ToInteger(q), Bignum.ToInteger(remainder));
                    return(false);
                }
                else
                {
                    throw new NotImplementedException("Divide bignum by non-bignum.");
                }
            }
            else
            {
                long w0        = Widen(left);
                long w1        = Widen(right);
                long remainder = 0;
                long quotient  = Math.DivRem(w0, w1, out remainder);

                answer = new Cons(Narrow(quotient), Narrow(remainder));
                return(false);
            }
        }
Example #11
0
        Combination(Cons components)
            : base()
        {
            SCode[] comps = new SCode [components.Length()];
            int     j     = 0;

            while (components != null)
            {
                SCode component = EnsureSCode(components.Car);
                comps [j]  = component;
                components = (Cons)(components.Cdr);
                j         += 1;
            }
            this.components = comps;
#if DEBUG
            this.histogramKey = this.components [0].GetType().ToString();
            for (int i = 1; i < this.components.Length; i++)
            {
                this.histogramKey = this.histogramKey + " " + this.components [i].GetType().ToString();
            }
#endif
        }
Example #12
0
 public static bool Assq(out object answer, object arg0, object arg1)
 {
     if (arg0 == null ||
         arg0 is bool ||
         arg0 is int ||
         arg0 is char ||
         arg0 is long)
     {
         throw new NotImplementedException();
     }
     for (Cons tail = (Cons)arg1; tail != null; tail = (Cons)tail.Cdr)
     {
         Cons entry = (Cons)tail.Car;
         if (entry.Car == arg0)
         {
             answer = entry;
             return(false);
         }
     }
     answer = false;
     return(false);
 }
Example #13
0
 public static bool PrimitiveCons(out object answer, object car, object cdr)
 {
     answer = new Cons (car, cdr);
     return false;
 }
Example #14
0
 internal ApplyFromPrimitive(IApplicable op, Cons rands)
     : base()
 {
     this.op = op;
     this.rands = rands;
 }
Example #15
0
 internal ApplyFromPrimitive(IApplicable op, Cons rands)
     : base()
 {
     this.op    = op;
     this.rands = rands;
 }
Example #16
0
 public static bool PrimitivePurify(out object answer, object obj, object isPure, object space)
 {
     answer = new Cons (true, 0x1000);
     return false;
 }
Example #17
0
 internal static object FromList(Cons cons)
 {
     return(Combination.Make(cons.ToVector()));
 }
Example #18
0
        internal object ReadObject(uint location)
        {
            object probe = null;
            if (this.sharingTable.TryGetValue (location, out probe) == true)
                return probe;

            EncodedObject encoded =
                  heapSection.Contains (location) ? heapSection [location]
                : constSection.Contains (location) ? constSection [location]
                : new EncodedObject (0);
            // Console.WriteLine ("{0}", encoded.TypeCode);
            object first = null;
            switch (encoded.TypeCode)
            {
                case TC.ACCESS:
                    return  Access.Make (ReadObject (encoded.Datum),
                       (Symbol) ReadObject (encoded.Datum + 4));

                case TC.ASSIGNMENT:
                    return ReadAssignment (encoded.Datum);

                case TC.BIG_FIXNUM:
                    return ReadBignum (encoded.Datum);

                case TC.BIG_FLONUM:
                    return ReadBigFlonum (encoded.Datum);

                case TC.CHARACTER:
                    return (char) (encoded.Datum);

                case TC.CHARACTER_STRING:
                    return heapSection.ReadString (encoded.Datum);

                case TC.COMBINATION:
                    return Combination.Make (ReadVector (encoded.Datum));

                case TC.COMBINATION_1:
                    return Combination1.Make (ReadObject (encoded.Datum),
                                             ReadObject (encoded.Datum + 4));

                case TC.COMBINATION_2:
                    return Combination2.Make (ReadObject (encoded.Datum),
                                              ReadObject (encoded.Datum + 4),
                                              ReadObject (encoded.Datum + 8));

                case TC.COMMENT:
                    return Comment.Make (ReadObject (encoded.Datum),
                                         ReadObject (encoded.Datum + 4));

                case TC.COMPLEX:
                    return new Complex (ReadObject (encoded.Datum),
                                        ReadObject (encoded.Datum + 4));

                case TC.CONDITIONAL:
                    return Conditional.Make (ReadObject (encoded.Datum),
                                             ReadObject (encoded.Datum + 4),
                                             ReadObject (encoded.Datum + 8));

                case TC.CONSTANT:
                    return Constant.Decode (encoded.Datum);

                case TC.DEFINITION:
                    return Definition.Make ((Symbol) ReadObject (encoded.Datum),
                                           ReadObject (encoded.Datum + 4));

                case TC.DELAY:
                    return Delay.Make (ReadObject (encoded.Datum));

                case TC.DISJUNCTION:
                    return Disjunction.Make (ReadObject (encoded.Datum),
                                            ReadObject (encoded.Datum + 4));

                case TC.EXTENDED_LAMBDA:
                    return ReadExtendedLambda (encoded.Datum);

                case TC.FIXNUM:
                    return encoded.Datum > 0x02000000
                           ? (int) - (0x04000000 - encoded.Datum)
                           : (int) encoded.Datum;

                case TC.INTERNED_SYMBOL:
                    return Symbol.Make (new String ((char []) ReadObject (encoded.Datum)));

                case TC.LAMBDA:
                    Symbol name;
                    Symbol [] formals;
                    ReadFormals (encoded.Datum + 4, out name, out formals);
                    return Lambda.Make (name, formals, SCode.EnsureSCode (ReadObject (encoded.Datum)));

                case TC.LIST:
                    object second = ReadObject (encoded.Datum + 4);
                    return new Cons (ReadObject (encoded.Datum),
                                     second == sharpF ? null : second);

                case TC.NULL:
                    if (encoded.Datum != 0)
                        throw new NotImplementedException ();
                    return sharpF;

                 case TC.PCOMB0:
                    return PrimitiveCombination0.Make ((Primitive0) primSection[encoded.Datum]);

                case TC.PCOMB1:
                    return PrimitiveCombination1.Make ((Primitive1) ReadObject (encoded.Datum),
                                                       ReadObject (encoded.Datum + 4));

                case TC.PCOMB2:
                    return PrimitiveCombination2.Make ((Primitive2) ReadObject (encoded.Datum),
                                                        ReadObject (encoded.Datum + 4),
                                                        ReadObject (encoded.Datum + 8));

                case TC.PCOMB3:
                    return PrimitiveCombination3.Make ((Primitive3) ReadObject (encoded.Datum + 4),
                                                       ReadObject (encoded.Datum + 8),
                                                       ReadObject (encoded.Datum + 12),
                                                       ReadObject (encoded.Datum + 16));

                case TC.PRIMITIVE:
                    return primSection [encoded.Datum];

                case TC.REFERENCE_TRAP:
                    if (encoded.Datum == 0)
                        return ReferenceTrap.Unassigned;
                    else
                        throw new NotImplementedException ();
                    // return ReferenceTrap.Make (encoded.Datum);

                case TC.RATNUM:
                    return new Ratnum (ReadObject (encoded.Datum),
                                       ReadObject (encoded.Datum + 4));

                case TC.RETURN_CODE:
                    return (ReturnCode) (encoded.Datum);

                case TC.SEQUENCE_2:
                    return Sequence2.Make (ReadObject (encoded.Datum),
                                          ReadObject (encoded.Datum + 4));

                case TC.SEQUENCE_3:
                    // Chains of sequence_3 can be arbitrarily long.
                    // Unfortunately, the CLR puts a strict limit on
                    // the stack, so we have to do this funky thing.
                    Cons sequenceStack = null;
                    while (true) {
                        // read the first two elements
                        object s1 = ReadObject (encoded.Datum);
                        sequenceStack = new Cons (s1, sequenceStack);
                        object s2 = ReadObject (encoded.Datum + 4);
                        sequenceStack = new Cons (s2, sequenceStack);

                        // peek at the third

                        EncodedObject sencoded =
                             heapSection.Contains (encoded.Datum + 8) ? heapSection [encoded.Datum + 8]
                           : constSection.Contains (encoded.Datum + 8) ? constSection [encoded.Datum + 8]
                           : new EncodedObject (0);

                        if (sencoded.TypeCode == TC.SEQUENCE_3)
                            encoded = sencoded;
                        else {
                            // found the end of the chain!
                            object tail = ReadObject (encoded.Datum + 8);
                            while (sequenceStack != null) {
                                object ob2 = sequenceStack.Car;
                                sequenceStack = (Cons) sequenceStack.Cdr;
                                object ob1 = sequenceStack.Car;
                                sequenceStack = (Cons) sequenceStack.Cdr;
                                tail = Sequence3.Make (ob1, ob2, tail);
                            }
                            return tail;
                        }
                    }

                case TC.THE_ENVIRONMENT:
                    return TheEnvironment.Make ();

                case TC.UNINTERNED_SYMBOL:
                    // KLUDGE!!  Make sure that all uninterned strings within a file
                    // keep their identity when read.
                    // Also, postpend a unique number so we can tell these apart.
                    first = ReadObject (encoded.Datum);
                    if (first is Symbol)
                        return first;
                    else
                    {
                        Symbol result = Symbol.MakeUninterned ("#:" + new String ((char []) first) + "-" + (gensymCounter++).ToString(CultureInfo.InvariantCulture));
                        this.sharingTable.Add (encoded.Datum, result);
                        return result;
                    }

                case TC.VARIABLE:
                    return Variable.Make ((Symbol) ReadObject (encoded.Datum));

                case TC.VECTOR:
                    return ReadVector (encoded.Datum);

                default:
                    throw new NotImplementedException ();
            }
        }
Example #19
0
 public ReferenceTrap(Cons obj)
 {
     this.contents = obj;
 }
Example #20
0
 ReferenceTrap()
 {
     contents = null;
 }
Example #21
0
 public static ReferenceTrap Make(Cons arg)
 {
     return(new ReferenceTrap(arg));
 }
Example #22
0
        public bool Apply(out object answer, ref Control expression, ref Environment environment, object [] args)
        {
#if DEBUG
            SCode.location = "-";
            this.BumpCallCount();
            SCode.location = "StandardExtendedClosure.Apply";
            SCode.NoteCalls(this, this.closureLambda.Body);
#endif
            int  nargs     = args.Length;
            int  nparams   = this.closureLambda.Formals.Length; // param 0 is self
            int  formals   = (int)this.closureLambda.required;
            int  parms     = (int)this.closureLambda.optional + formals;
            bool rest_flag = this.closureLambda.rest;
            int  auxes     = nparams - (parms + (rest_flag ? 1 : 0));

            if (nargs < formals)
            {
                throw new NotImplementedException("Too few arguments.");
            }
            else if (!rest_flag & (nargs > parms))
            {
                throw new NotImplementedException("Too many arguments.");
            }
            int size = parms + (rest_flag ? 1 : 0) + auxes;

            int       argptr      = 0;
            int       frameptr    = 0;
            object [] framevector = new object [size];

            if (nargs <= parms)
            {
                int i;
                for (i = (nargs); --i >= 0;)
                {
                    framevector [frameptr++] = args [argptr++];
                }
                for (i = (parms - nargs); --i >= 0;)
                {
                    framevector [frameptr++] = Constant.DefaultObject;
                }
                if (rest_flag)
                {
                    framevector [frameptr++] = null;
                }
                for (i = auxes; --i >= 0;)
                {
                    framevector [frameptr++] = Constant.DefaultObject;
                }
            }
            else
            {
                // theRestMarker flag must be true
                int i;
                int listloc;
                for (i = (parms); --i >= 0;)
                {
                    framevector [frameptr++] = args [argptr++];
                }
                listloc = frameptr++;
                framevector [listloc] = null;
                for (i = auxes; --i >= 0;)
                {
                    throw new NotImplementedException();
                    //framevector [frameptr++] = Constant.Unassigned;
                }
                argptr = args.Length;
                for (i = (nargs - parms); --i >= 0;)
                {
                    framevector [listloc] = new Cons(args [--argptr], framevector [listloc]);
                }
            }
            expression  = this.closureLambda.Body;
            environment = new StandardEnvironment <StandardExtendedLambda, StandardExtendedClosure> (this, framevector);
            answer      = null;
            return(true);
        }
Example #23
0
 public ReferenceTrap(Cons obj)
 {
     this.contents = obj;
 }
Example #24
0
 public static ReferenceTrap Make(Cons arg)
 {
     return new ReferenceTrap (arg);
 }
Example #25
0
        internal object ReadObject(uint location)
        {
            object probe = null;

            if (this.sharingTable.TryGetValue(location, out probe) == true)
            {
                return(probe);
            }

            EncodedObject encoded =
                heapSection.Contains(location) ? heapSection [location]
                : constSection.Contains(location) ? constSection [location]
                : new EncodedObject(0);
            // Console.WriteLine ("{0}", encoded.TypeCode);
            object first = null;

            switch (encoded.TypeCode)
            {
            case TC.ACCESS:
                return(Access.Make(ReadObject(encoded.Datum),
                                   (Symbol)ReadObject(encoded.Datum + 4)));

            case TC.ASSIGNMENT:
                return(ReadAssignment(encoded.Datum));

            case TC.BIG_FIXNUM:
                return(ReadBignum(encoded.Datum));

            case TC.BIG_FLONUM:
                return(ReadBigFlonum(encoded.Datum));

            case TC.CHARACTER:
                return((char)(encoded.Datum));

            case TC.CHARACTER_STRING:
                return(heapSection.ReadString(encoded.Datum));

            case TC.COMBINATION:
                return(Combination.Make(ReadVector(encoded.Datum)));

            case TC.COMBINATION_1:
                return(Combination1.Make(ReadObject(encoded.Datum),
                                         ReadObject(encoded.Datum + 4)));

            case TC.COMBINATION_2:
                return(Combination2.Make(ReadObject(encoded.Datum),
                                         ReadObject(encoded.Datum + 4),
                                         ReadObject(encoded.Datum + 8)));

            case TC.COMMENT:
                return(Comment.Make(ReadObject(encoded.Datum),
                                    ReadObject(encoded.Datum + 4)));

            case TC.COMPLEX:
                return(new Complex(ReadObject(encoded.Datum),
                                   ReadObject(encoded.Datum + 4)));

            case TC.CONDITIONAL:
                return(Conditional.Make(ReadObject(encoded.Datum),
                                        ReadObject(encoded.Datum + 4),
                                        ReadObject(encoded.Datum + 8)));

            case TC.CONSTANT:
                return(Constant.Decode(encoded.Datum));

            case TC.DEFINITION:
                return(Definition.Make((Symbol)ReadObject(encoded.Datum),
                                       ReadObject(encoded.Datum + 4)));

            case TC.DELAY:
                return(Delay.Make(ReadObject(encoded.Datum)));

            case TC.DISJUNCTION:
                return(Disjunction.Make(ReadObject(encoded.Datum),
                                        ReadObject(encoded.Datum + 4)));

            case TC.EXTENDED_LAMBDA:
                return(ReadExtendedLambda(encoded.Datum));

            case TC.FIXNUM:
                return(encoded.Datum > 0x02000000
                           ? (int)-(0x04000000 - encoded.Datum)
                           : (int)encoded.Datum);

            case TC.INTERNED_SYMBOL:
                return(Symbol.Make(new String((char [])ReadObject(encoded.Datum))));

            case TC.LAMBDA:
                Symbol    name;
                Symbol [] formals;
                ReadFormals(encoded.Datum + 4, out name, out formals);
                return(Lambda.Make(name, formals, SCode.EnsureSCode(ReadObject(encoded.Datum))));

            case TC.LIST:
                object second = ReadObject(encoded.Datum + 4);
                return(new Cons(ReadObject(encoded.Datum),
                                second == sharpF ? null : second));

            case TC.NULL:
                if (encoded.Datum != 0)
                {
                    throw new NotImplementedException();
                }
                return(sharpF);

            case TC.PCOMB0:
                return(PrimitiveCombination0.Make((Primitive0)primSection[encoded.Datum]));

            case TC.PCOMB1:
                return(PrimitiveCombination1.Make((Primitive1)ReadObject(encoded.Datum),
                                                  ReadObject(encoded.Datum + 4)));

            case TC.PCOMB2:
                return(PrimitiveCombination2.Make((Primitive2)ReadObject(encoded.Datum),
                                                  ReadObject(encoded.Datum + 4),
                                                  ReadObject(encoded.Datum + 8)));

            case TC.PCOMB3:
                return(PrimitiveCombination3.Make((Primitive3)ReadObject(encoded.Datum + 4),
                                                  ReadObject(encoded.Datum + 8),
                                                  ReadObject(encoded.Datum + 12),
                                                  ReadObject(encoded.Datum + 16)));

            case TC.PRIMITIVE:
                return(primSection [encoded.Datum]);

            case TC.REFERENCE_TRAP:
                if (encoded.Datum == 0)
                {
                    return(ReferenceTrap.Unassigned);
                }
                else
                {
                    throw new NotImplementedException();
                }
            // return ReferenceTrap.Make (encoded.Datum);

            case TC.RATNUM:
                return(new Ratnum(ReadObject(encoded.Datum),
                                  ReadObject(encoded.Datum + 4)));

            case TC.RETURN_CODE:
                return((ReturnCode)(encoded.Datum));

            case TC.SEQUENCE_2:
                return(Sequence2.Make(ReadObject(encoded.Datum),
                                      ReadObject(encoded.Datum + 4)));

            case TC.SEQUENCE_3:
                // Chains of sequence_3 can be arbitrarily long.
                // Unfortunately, the CLR puts a strict limit on
                // the stack, so we have to do this funky thing.
                Cons sequenceStack = null;
                while (true)
                {
                    // read the first two elements
                    object s1 = ReadObject(encoded.Datum);
                    sequenceStack = new Cons(s1, sequenceStack);
                    object s2 = ReadObject(encoded.Datum + 4);
                    sequenceStack = new Cons(s2, sequenceStack);

                    // peek at the third

                    EncodedObject sencoded =
                        heapSection.Contains(encoded.Datum + 8) ? heapSection [encoded.Datum + 8]
                           : constSection.Contains(encoded.Datum + 8) ? constSection [encoded.Datum + 8]
                           : new EncodedObject(0);

                    if (sencoded.TypeCode == TC.SEQUENCE_3)
                    {
                        encoded = sencoded;
                    }
                    else
                    {
                        // found the end of the chain!
                        object tail = ReadObject(encoded.Datum + 8);
                        while (sequenceStack != null)
                        {
                            object ob2 = sequenceStack.Car;
                            sequenceStack = (Cons)sequenceStack.Cdr;
                            object ob1 = sequenceStack.Car;
                            sequenceStack = (Cons)sequenceStack.Cdr;
                            tail          = Sequence3.Make(ob1, ob2, tail);
                        }
                        return(tail);
                    }
                }


            case TC.THE_ENVIRONMENT:
                return(TheEnvironment.Make());

            case TC.UNINTERNED_SYMBOL:
                // KLUDGE!!  Make sure that all uninterned strings within a file
                // keep their identity when read.
                // Also, postpend a unique number so we can tell these apart.
                first = ReadObject(encoded.Datum);
                if (first is Symbol)
                {
                    return(first);
                }
                else
                {
                    Symbol result = Symbol.MakeUninterned("#:" + new String((char [])first) + "-" + (gensymCounter++).ToString(CultureInfo.InvariantCulture));
                    this.sharingTable.Add(encoded.Datum, result);
                    return(result);
                }

            case TC.VARIABLE:
                return(Variable.Make((Symbol)ReadObject(encoded.Datum)));

            case TC.VECTOR:
                return(ReadVector(encoded.Datum));

            default:
                throw new NotImplementedException();
            }
        }
Example #26
0
 public static bool PrimitivePurify(out object answer, object obj, object isPure, object space)
 {
     answer = new Cons(true, 0x1000);
     return(false);
 }
Example #27
0
 public static bool PrimitiveCons(out object answer, object car, object cdr)
 {
     answer = new Cons(car, cdr);
     return(false);
 }
Example #28
0
 ReferenceTrap()
 {
     contents = null;
 }
Example #29
0
 public static bool SystemSubvectorToList(out object answer, object arg, object start, object end)
 {
     ISystemVector sysVec = arg as ISystemVector;
     if (sysVec != null) {
         Cons result = null;
         for (int i = (int) end - 1; i > ((int) start - 1); i--) {
             result = new Cons (sysVec.SystemVectorRef (i), result);
         }
         answer = result;
         return false;
     }
     else throw new NotImplementedException ();
 }