def add(other)
      case other
      when LinExpr
        @terms.merge!(other.terms) { |_, c1, c2| c1 + c2 }
      when Variable
        if @terms.key? other
          @terms[other] += 1.0
        else
          @terms[other] = 1.0
        end
      else
        fail TypeError
      end

      self
    end
def add(other)
      case other
      when LinExpr
        @terms.merge!(other.terms) { |_, c1, c2| c1 + c2 }
      when Variable
        if @terms.key? other
          @terms[other] += 1.0
        else
          @terms[other] = 1.0
        end
      else
        fail TypeError
      end

      self
    end
def add ( other ) case other when LinExpr @terms . merge! ( other . terms ) { | _ , c1 , c2 | c1 + c2 } when Variable if @terms . key? other @terms [ other ] += 1.0 else @terms [ other ] = 1.0 end else fail TypeError end self end
Add terms from the other expression to this one
Add terms from the other expression to this one