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; }
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); }
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; }
public void LoadFunction(List f) { Push(List.Cons(f, Env)); }
public void Push(object o, ref List list) { list = List.Cons(o, list); }
[Callable] public void cons() { Push(List.Cons(Pop(), Pop())); }
public static dynamic pair(dynamic a, dynamic b) { return(List.Cons(a, b)); }