Open brando90 opened 7 years ago
seems the realistic thing to aim for is:
question = solve + x + perg( Eq(a,b),Eq(x,2*b),Eq(a,8)) + 'can you do it?'
by overriding some type of __add__
or __addition__
(whatever the name is)
the goal is that previous question should not break!
just sort of as an alternative syntactic sugar for people (easier/more intuitive to code)
Implemented Q() and A() subclasses of DelayedExecution and '+' operator overload. New option for syntax:
question = Q() + 'solve' + x + perg( Eq(a,b),Eq(x,2*b),Eq(a,8)) + 'can you do it?'
or
question = Q() question += 'solve' + x + perg( Eq(a,b),Eq(x,2*b),Eq(a,8)) + 'can you do it?'
Possible next step: | or / for perg
is this still relevant?
Consider this example
first Syntax just probably requires overriding the + for python or implementing our own addition for seqg class.
second might require bigger hacking of python...not sure how to do it (we want to avoid parsers, at least at the moment).
One comment for either implementation. The having multiple additions means the tree might have more levels than neccessary, so if we have . A+B+C+perg(D,E,F)+G we would want all the additions at the same level of the tree when visualizing in the call graph (http://pycallgraph.slowchop.com/en/master/) mention in https://github.com/brando90/eit_proj1/issues/10