Module: Alf::Algebra::Visitor

Included in:
Compiler, Rewriter
Defined in:
lib/alf/algebra/support/visitor.rb

Instance Method Summary collapse

Instance Method Details

#copy_and_apply(expr) ⇒ Object


5
6
7
8
9
10
11
# File 'lib/alf/algebra/support/visitor.rb', line 5

def copy_and_apply(expr)
  if expr.is_a?(Algebra::Operator)
    expr.with_operands(*expr.operands.map{|op| apply(op) })
  else
    expr
  end
end