def _list_of_values(self, expressions, env): if procedure.no_operands(expressions): return EmptyList else: return cons( self._eval(procedure.first_operand(expressions), env), self._list_of_values(procedure.rest_operands(expressions), env))
def _eval_and(self, expr, env): if procedure.no_operands(procedure.operands(expr)): return Boolean(True) def inner(expr, env): if sequence.is_last_expr(expr): return self._eval(sequence.first_expr(expr), env) if not self._eval(sequence.first_expr(expr), env): return Boolean(False) return inner(sequence.rest_exprs(expr), env) return inner(sequence.rest_exprs(expr), env)
def _eval_or(self, expr, env): if procedure.no_operands(procedure.operands(expr)): return Boolean(False) def inner(expr, env): if sequence.is_last_expr(expr): return self._eval(sequence.first_expr(expr), env) first_value = self._eval(sequence.first_expr(expr), env) if first_value: return first_value return inner(sequence.rest_exprs(expr), env) return inner(sequence.rest_exprs(expr), env)