```As already pointed out in earlier an if statement that is almost the same
eon each side with the exception of function calls cam be factored with

func = ? (logic) :func1 : :func2

latter Objec.send(func)

I find all those long equations pretty offensive, similar and unclear and
think that they should be factored

I don't have a clue what you are trying to do with the code but you could
factor all those equations to something sample like

BigEqn( left_or_right , type_of_eqn )

where the type gives the array to multiply by or some other suitable thing
that relates to what that equation actually means.  This may also solve your
earlier problem without using the send

Ralph

From: "Mark Hahn" <mchahn / facelink.com>

> The two if statements below are identical except the words left and right
> (and < & >) are reversed.  I don't think this can be factored but I
thought
> I'd throw this out to see if anyone can think of a way.
>
> I thought maybe some sort of text pre-processing could help, but then I
> realized the resulting code would be the same.
>
> def find key, countIn
>   if key < @key
>     @leftCount += 1
>     if @left
>       nextNode = @left; nextCount = @leftCount
>       matchCount = countIn-@leftCount-@rightCount
>       leftMatchCount = @leftCount- / left.rightCount-@left.leftCount
>       if 3*@rightCount+2*matchCount+1*leftMatchCount+2*@left.leftCount <
>          2*@rightCount+1*matchCount+2*leftMatchCount+3*@left.leftCount
>         @left.right,@left,nextCount,@leftCount,@left.rightCount =
>
>
self,@left.right,countIn,@left.rightCount,countIn-@leftCount+@left.rightCoun
> t
>       end
>       return nextNode.find(key,nextCount)
>     end
>   end
>   if key > @key
>     @rightCount += 1
>     if @right
>       nextNode = @right; nextCount = @rightCount
>       matchCount = countIn-@leftCount-@rightCount
>       rightMatchCount = @rightCount- / right.leftCount-@right.rightCount
>       if 3*@leftCount+2*matchCount+1*rightMatchCount+2*@right.rightCount <
>          2*@leftCount+1*matchCount+2*rightMatchCount+3*@right.rightCount
>         @right.left,@right,nextCount,@rightCount,@right.leftCount =
>
>
self,@right.left,countIn,@right.leftCount,countIn-@rightCount+@right.leftCou
> nt
>       end
>       return nextNode.find(key,nextCount)
>     end
>   end
>   return self
> end
>
>

```