interpreters/let-proc/let_grammar.rb
# We use lazy enumerators for short circuiting the operations because we don't
# need to evaluate all the expressions. We can bail as soon as we see a false result.
We use lazy enumerators for short circuiting the operations because we don't
need to evaluate all the expressions. We can bail as soon as we see a false result.
We use lazy enumerators for short circuiting the operations because we don ' t need to evaluate all the expressions . We can bail as soon as we see a false result .
def eval(env, op)
      lazy_exprs = self.expressions.lazy
      pairs = lazy_exprs.zip(lazy_exprs.drop(1)).take(self.expressions.length - 1)
      pairs.each {|x, y| return false unless x.eval(env).send(op, y.eval(env))}
      true
    end
def eval ( env , op ) lazy_exprs = self . expressions . lazy pairs = lazy_exprs . zip ( lazy_exprs . drop ( 1 ) ) . take ( self . expressions . length - 1 ) pairs . each { | x , y | return false unless x . eval ( env ) . send ( op , y . eval ( env ) ) } true end
We use lazy enumerators for short circuiting the operations because we don't
need to evaluate all the expressions.
We use lazy enumerators for short circuiting the operations because we don ' t need to evaluate all the expressions .
env
<not_specific>
op
<not_specific>