Example #1
0
 def __call__(self, stack, envs, objs):
     if objs is not None:
         self.r.append(objs)
     if self.params[0] is objects.nil:
         return objects.to_list(self.r)
     t = map(lambda i: i.car, self.params)
     self.params = map(lambda i: i.cdr, self.params)
     return stack.call(interrupter.CallStatus(
             self.func, objects.to_list(t), objects.nil), envs)
Example #2
0
 def __call__(self, stack, envs, objs):
     if objs is not None:
         if objs:
             self.r.append(self.params.car)
         self.params = self.params.cdr
     if self.params is objects.nil:
         return objects.to_list(self.r)
     return stack.call(interrupter.CallStatus(
             self.func, objects.OCons(self.params.car), objects.nil), envs)
Example #3
0
def logic_if(stack, envs, objs):
    return stack.jump(CondStatus(objects.OCons(
                objects.to_list([objs[0], objs[1]])), objs.get(2)), envs)
Example #4
0
def list_append(_, _1, objs):
    r = []
    for obj in objs:
        r.extend(obj)
    return objects.to_list(r)
Example #5
0
def init(code, builtin_):
    stack = Stack()
    stack.append((PrognStatus(code), Envs(to_list([{}, builtin_,]))))
    return stack