示例#1
0
        public void TailApply()
        {
            List closure   = Pop();
            List paramlist = Pop();

            Env = List.Cons(closure.Tail, Env.Tail);
            Push(paramlist, ref Env);
            Code  = closure.Head;
            Stack = List.Empty;
        }
示例#2
0
 public static dynamic Substitute(Dictionary <string, dynamic> bindings, dynamic x)
 {
     if (x is String && bindings.ContainsKey(x))
     {
         return(bindings[x]);
     }
     if (x is List && !x.IsEmpty)
     {
         return(List.Cons(Substitute(bindings, x.Head), Substitute(bindings, x.Tail)));
     }
     return(x);
 }
示例#3
0
        public void RecApply()
        {
            Push(Stack, ref Dump);
            Push(Env, ref Dump);
            Push(Code, ref Dump);
            List closure   = Pop();
            List paramlist = Pop();

            Env = List.Cons(closure.Tail, Env.Tail);
            Push(paramlist, ref Env);
            Code  = closure.Head;
            Stack = List.Empty;
        }
示例#4
0
 public void LoadFunction(List f)
 {
     Push(List.Cons(f, Env));
 }
示例#5
0
 public void Push(object o, ref List list)
 {
     list = List.Cons(o, list);
 }
示例#6
0
 [Callable] public void cons()
 {
     Push(List.Cons(Pop(), Pop()));
 }
示例#7
0
 public static dynamic pair(dynamic a, dynamic b)
 {
     return(List.Cons(a, b));
 }