Beispiel #1
0
 def eval(self, environment):
     if trueExpr(self._test.eval(environment)):
         return self._cons.eval(environment)
     else:
         if self._alt:
             return self._alt.eval(environment)
         else:
             return None
Beispiel #2
0
 def eval(self, environment):
     if not self._tests:
         return FALSE
     
     for test in self._tests[:-1]:
         value = test.eval(environment)
         if trueExpr(value):
             return value
     return self._tests[-1].eval(environment)
Beispiel #3
0
 def evalTest(self, environment):
     """Evaluates the test and returns true if the test evaluates
     to true.
     """
     return trueExpr(self._test.eval(environment))