On Wed, Jul 3, 2013 at 7:27 PM, Ronan Lamy <[email protected]> wrote: > 2013/7/4 Aaron Meurer <[email protected]> >> >> On Wed, Jul 3, 2013 at 5:40 PM, Ronan Lamy <[email protected]> wrote: >> > 2013/7/3 Ondřej Čertík <[email protected]> >> >> >> >> On Wed, Jul 3, 2013 at 1:48 PM, Aaron Meurer <[email protected]> >> >> wrote: >> >> >> >> Why wouldn't simple type based dispatch work? >> >> You might be right, I just want to understand the problem more. >> >> >> >> To answer Aaron's question: >> >> >> >> On Wed, Jul 3, 2013 at 12:58 PM, Aaron Meurer <[email protected]> >> >> wrote: >> >> > So, going back to what we discussed the first time we met in Los >> >> > Alamos, how would you reimplement something like the oo logic so that >> >> > it lives entirely in the Infinity class, not in Add.flatten (say for >> >> > simplicity, oo + 3 should go to oo, but oo + 3*I should remain as oo >> >> > + >> >> > 3*I)? >> >> >> >> This, and another example is x + O(x). Let's stick to oo + 3. >> > >> > >> > x + O(x) is a bad example, because it should really not be represented >> > by an >> > Add. >> > >> >> This is a very good question and it is one of the details that I don't >> >> know the answer 100% yet. >> >> But I feel it is solvable. >> >> >> >> I think the best would be to create a demo (from scratch) where we can >> >> play with these ideas. Hopefully I'll get to this eventually. >> > >> > >> > How about this: https://github.com/rlamy/sympy/commits/binop ? >> >> It's tough to mull through a list of commits, > > > You could just look at sympy/core/binop.py, it's quite short.
OK, this is what you really want to look at https://github.com/rlamy/sympy/compare/binop. > >> >> so let me just ask you >> some questions about it (I know you posted this branch a while ago, >> but I forgot the details). >> >> - Does it handle nary operations or just binary? > > > Just binary. Any thoughts how to extend it to nary? >> >> >> - What about *args like Mul.flatten? > > > It doesn't do anything about it. Ditto here. >> >> >> - If two types register dispatchers against one another, what are the >> precedence rules? > > > There are no precedence rules. If the dispatcher doesn't find a unique most > derived implementation (e.g. if it finds implementations for types (A1, A2) > and (B1, B2) such that A1 strictly subclasses B1 and B2 strictly subclasses > A2) then it raises an error. OK, but there is some kind of precedence on subclasses, right? Aaron Meurer >> >> >> Aaron Meurer >> >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "sympy" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> > an >> > email to [email protected]. >> > To post to this group, send email to [email protected]. >> > Visit this group at http://groups.google.com/group/sympy. >> > For more options, visit https://groups.google.com/groups/opt_out. >> > >> > >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sympy" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/sympy. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sympy. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.
