def define_binary_method( mod, op, coercion = :coercion )
      mod.module_eval do
        define_method "#{op}_with_hornetseye" do |a,b|
          if a.matched? or b.matched?
            a = Node.match(a, b).new a unless a.matched?
            b = Node.match(b, a).new b unless b.matched?
            if a.dimension == 0 and a.variables.empty? and
               b.dimension == 0 and b.variables.empty?
              target = a.typecode.send coercion, b.typecode
              target.new mod.send(op, a.simplify.get, b.simplify.get)
            else
              Hornetseye::ElementWise( proc { |x,y| mod.send op, x, y },
                                       "#{mod}.#{op}",
                                       proc { |t,u| t.send coercion, u } ).
                new(a, b).force
            end
          else
            send "#{op}_without_hornetseye", a, b
          end
        end
        alias_method_chain op, :hornetseye
        module_function "#{op}_without_hornetseye"
        module_function op
      end
    end
def define_binary_method( mod, op, coercion = :coercion )
      mod.module_eval do
        define_method "#{op}_with_hornetseye" do |a,b|
          if a.matched? or b.matched?
            a = Node.match(a, b).new a unless a.matched?
            b = Node.match(b, a).new b unless b.matched?
            if a.dimension == 0 and a.variables.empty? and
               b.dimension == 0 and b.variables.empty?
              target = a.typecode.send coercion, b.typecode
              target.new mod.send(op, a.simplify.get, b.simplify.get)
            else
              Hornetseye::ElementWise( proc { |x,y| mod.send op, x, y },
                                       "#{mod}.#{op}",
                                       proc { |t,u| t.send coercion, u } ).
                new(a, b).force
            end
          else
            send "#{op}_without_hornetseye", a, b
          end
        end
        alias_method_chain op, :hornetseye
        module_function "#{op}_without_hornetseye"
        module_function op
      end
    end
Extend binary method with capability to handle arrays

 @param [Module] mod The mathematics module.
 @param [Symbol,String] op The binary method to extend.
 @param [Symbol,String] conversion A method for doing the type balancing.
 @return [Proc] The new method.

 @private