Example #1
0
def execRands(rands, env, cont):
    """Executes each operand and constructs a new list."""
    def eval_first_cont(headVal):
        def eval_rest_cont(tailVal):
            return pogo.bounce(cont, pair.cons(headVal, tailVal))
        return execRands(expressions.restOperands(rands), env, eval_rest_cont)
    if pair.isNull(rands):
        return pogo.bounce(cont, pair.NIL)
    return texec(expressions.firstOperand(rands),
                 env, eval_first_cont)
Example #2
0
def evalRands(exps, env, cont):
    """Given a list of expressions, returns a new list containing the
    values of evaluating each on of them.  If the continuation is
    given, then calls cont() on the evaluated operands instead."""
    def c1(head_val):
        def c2(tail_val):
            return pogo.bounce(cont, pair.cons(head_val, tail_val))
        return evalRands(expressions.restOperands(exps), env, c2)
    if expressions.isNoOperands(exps):
        return pogo.bounce(cont, pair.list())
    return teval(expressions.firstOperand(exps), env, c1)
Example #3
0
def evalRands(exps, env, cont):
    """Given a list of expressions, returns a new list containing the
    values of evaluating each on of them.  If the continuation is
    given, then calls cont() on the evaluated operands instead."""
    def c1(head_val):
        def c2(tail_val):
            return pogo.bounce(cont, pair.cons(head_val, tail_val))

        return evalRands(expressions.restOperands(exps), env, c2)

    if expressions.isNoOperands(exps):
        return pogo.bounce(cont, pair.list())
    return teval(expressions.firstOperand(exps), env, c1)