Distributive rule of arithemtic: a*b + a*c => a * (b + c)
same for division
@M4tt30rru : please commit the tests, and give reference to this current issue in the commit message: You do that by writing "(issue 76)" somewhere in the commit message.
Tests are committed (one ignored). Not integrated as per request.
@yossigil :
@M4tt30rru :
Can you please clarify what should I do here ? I see that there is already an Implementation at
InfixMultiplicationDistributive.java
This is a complex issue: You need to first find terms, then find factors, then try to see if you can match factors, and apply a heuristic:
We will eventually end up doing a representation as expressions as Sum of Terms Where each Term is a product of Factors. Where each Factor is either a Term or Elementary where Elementary is something that does not have Plus and Minus or Times or Divide at the upper level.
with this assumption, here is my one suggestion: Make out a list of alternatives, and just pick out the best one. An alternative is defined by three: Term1, Term2, F, where F is a common factor to Term1 and Term2.
make each of these factors as long as possible, by adding more
I think it is pretty challenging, would take a lot of time, would be a wonderful challenge for testing, and is a total waste of time.
The rarity of such cases does not justify the trouble.
@M4tt30rru , FYI
Moved to bakclog
It should be easy, but more interesting is the zoomer here.
@ravivos : Are you on it for that week or can I do that ?
I think this one should be placed on hold. Tough, but not very effective or useful
@dormaayan I am on it, milestoned for next week
Why?
Because of the other tasks we have prioritized for this week... I guess it can be changed or squeezed in because it's a pretty easy issue. Not sure if it should, though
ok
Be careful: f() * g() + f() * h() != f() * (g() + h())